Re: $*, and $IFS, again

2025-03-15 Thread Steffen Nurpmeso
Robert Elz wrote in <19942.1742090...@jacaranda.noi.kre.to>: |Date:Sun, 16 Mar 2025 02:35:12 +0100 |From:Steffen Nurpmeso |Message-ID: <20250316013512.2aC3SIyk@steffen%sdaoden.eu> | || The problem is not an empty field. | |Your problem might not be, but it all

Re: $*, and $IFS, again

2025-03-15 Thread Robert Elz
Date:Sun, 16 Mar 2025 02:35:12 +0100 From:Steffen Nurpmeso Message-ID: <20250316013512.2aC3SIyk@steffen%sdaoden.eu> | The problem is not an empty field. Your problem might not be, but it all derives from that. | The problem is that ":a:" has to be splitted to ""

Re: $*, and $IFS, again

2025-03-15 Thread Steffen Nurpmeso
Robert Elz wrote in <21988.1742085...@jacaranda.noi.kre.to>: |Date:Sat, 15 Mar 2025 23:41:45 +0100 |From:Steffen Nurpmeso |Message-ID: <20250315224145.YPWRnxq7@steffen%sdaoden.eu> | || * Expands to the positional parameters, starting from one, || initially

Re: $*, and $IFS, again

2025-03-15 Thread Robert Elz
Date:Sat, 15 Mar 2025 23:59:24 +0100 From:Steffen Nurpmeso Message-ID: <20250315225924.1YC4dm9D@steffen%sdaoden.eu> | |And further, i have zero idea how shells come to the result that | |they do if they do *not* split the fields individually. But if | |they

Re: $*, and $IFS, again

2025-03-15 Thread Robert Elz
Date:Sat, 15 Mar 2025 23:41:45 +0100 From:Steffen Nurpmeso Message-ID: <20250315224145.YPWRnxq7@steffen%sdaoden.eu> | * Expands to the positional parameters, starting from one, | initially producing one field for each positional parameter that | is set

Re: $*, and $IFS, again

2025-03-15 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in <20250315225314.0SShmWUW@steffen%sdaoden.eu>: |Steffen Nurpmeso wrote in | <20250315224145.YPWRnxq7@steffen%sdaoden.eu>: ||Robert Elz wrote in || <8711.1742074...@jacaranda.noi.kre.to>: | ... || * Expands to the positional parameters, starting from one, ||init

Re: $*, and $IFS, again

2025-03-15 Thread Steffen Nurpmeso
Steffen Nurpmeso wrote in <20250315224145.YPWRnxq7@steffen%sdaoden.eu>: |Robert Elz wrote in | <8711.1742074...@jacaranda.noi.kre.to>: ... | * Expands to the positional parameters, starting from one, |initially producing one field for each positional parameter that |is set. When the

Re: $*, and $IFS, again

2025-03-15 Thread Steffen Nurpmeso
Robert Elz wrote in <8711.1742074...@jacaranda.noi.kre.to>: |I should have added in my last reply that if you want to investigate Before i apologise to Greg Wooledge i want to point out that POSIX says: * Expands to the positional parameters, starting from one, initially producing one fie

Re: $*, and $IFS, again

2025-03-15 Thread Greg Wooledge
On Sun, Mar 16, 2025 at 04:39:33 +0700, Robert Elz wrote: > ps: to anyone out there still reading this, when writing sh code, don't > lapse into writing C instead, in sh, when using quotes, use '' (or \) > whenever the quoted text is to be treated literally, and "" only when > you are expecting exp

Re: $*, and $IFS, again

2025-03-15 Thread Robert Elz
I should have added in my last reply that if you want to investigate field splitting, and how it works in various cases, use the expansion of a simple variable x=whatever IFS=something echo $x or better: args() { printf '#=%d' "$#"

Re: $*, and $IFS, again

2025-03-15 Thread Robert Elz
Date:Fri, 14 Mar 2025 22:47:38 +0100 From:Steffen Nurpmeso Message-ID: <20250314214738.Milbudgm@steffen%sdaoden.eu> | I cannot reproduce this, both NetBSD sh and bash say | | set -- '' '' a '' '' b '' '';echo $#,$*; set -- $*; echo $#,$* | 8, a b | 2,a

Re: $*, and $IFS, again

2025-03-14 Thread Steffen Nurpmeso
Hello Robert. Robert Elz wrote in <25006.1741917...@jacaranda.noi.kre.to>: |Date:Fri, 14 Mar 2025 01:34:48 +0100 |From:Steffen Nurpmeso |Message-ID: <20250314003448.DdqG5Ont@steffen%sdaoden.eu> | || I am deeply sorry, but i have one more difficulty that i fail t

Re: $*, and $IFS, again

2025-03-14 Thread Steffen Nurpmeso
Greg Wooledge wrote in <20250314024153.gh22...@wooledge.org>: Sorry Mr., but i have problems with your attitude; you also seem to have confused yourself, and i unfortunately thing that was not accidental. But thank you. --steffen | |Der Kragenbaer,The moon bear, |der holt sich mu

Re: $*, and $IFS, again

2025-03-13 Thread Greg Wooledge
On Fri, Mar 14, 2025 at 01:34:48 +0100, Steffen Nurpmeso wrote: > a() { > echo $#,1="$1"/$1,2="$2"/$2,3="$3"/$3,4="$4" > echo $#,'*'="$*"/$*, > } > set -- '' 'a' '' > #IFS=\ ; echo "$*"$* $*; a "$*"$* $*;unset IFS > #IFS= ; echo "$*"$* $*; a "$*"$* $*;unset IFS > IFS=:; echo "$*

Re: $*, and $IFS, again

2025-03-13 Thread Robert Elz
Date:Fri, 14 Mar 2025 01:34:48 +0100 From:Steffen Nurpmeso Message-ID: <20250314003448.DdqG5Ont@steffen%sdaoden.eu> | I am deeply sorry, but i have one more difficulty that i fail to | explain to myself. As always, there are no rules for this for MUAs so you can

$*, and $IFS, again

2025-03-13 Thread Steffen Nurpmeso
Hello again. I am deeply sorry, but i have one more difficulty that i fail to explain to myself. It *could* (small, very small case) be that this time the incorrectness really is on the side of bash. This script (do not care for the commented, they are great) a() { echo $#,1="$1"/$1,2="$2"

Re: $*, and $IFS, again

2025-03-13 Thread Steffen Nurpmeso
P.S.: the full test (proof, as bash is the example i compare against) script is this: # proof {{{ a() { b() { echo "b=$# 1<$1> 2<$2> 3<$3> 4<$4> 5<$5> 6<$6> 7<$7> 8<$8> 9<$9> 10<${10}> 11<${11}> 12<${12}> 13<${13}> 14<${14}> 15<${15}> 16<${16}> 17<${17}> 18<${18}> 19<${19