DASH Shell discussions
 help / color / mirror / Atom feed
* Question on $IFS related differences (Was: Question on $@ vs $@$@)
@ 2024-09-18  1:14 Steffen Nurpmeso
  2024-09-18  5:05 ` Oğuz
  0 siblings, 1 reply; 6+ messages in thread
From: Steffen Nurpmeso @ 2024-09-18  1:14 UTC (permalink / raw)
  To: dash, busybox, bug-bash; +Cc: Steffen Nurpmeso

Hello.

I am terribly sorry to be here once again; i already mentioned on
bug-bash@ the problem with IFS being reverse solidus that dash
(and myself) has (have).
I came back to this for my one again, and i stumble over one
additional difference in behaviour in between (myself and) bash,
dash and busybox sh.

We are still here, and this snippet gives identical results for
all, my MUA included,

  a() {
    echo $#,1=$1,2=$2,3=$3,4=$4,5=$5,6=$6,"$*",$*,
  }
  set -- '' '' ''
  IFS=' '; echo "$*"$* $*; a "$*"$* $*;unset IFS

ie, via "cat -vet":

    $
  1,1= ,2=,3=,4=,5=,6=,  , ,$

*However*, if we change IFS to : in the above:

  a() {
    echo $#,1=$1,2=$2,3=$3,4=$4,5=$5,6=$6,"$*",$*,
  }
  set -- '' '' ''
  IFS=':'; echo "$*"$* $*; a "$*"$* $*;unset IFS

then we get different behaviour for bash on the one side, dash and
busybox sh on the next, and myself on the third.  bash 5.2.32 says

  ::   $
  4,1=  ,2=,3=,4=,5=,6=,:::::,     ,$

whereas the ashs say

  ::$
  1,1=  ,2=,3=,4=,5=,6=,::,  ,$

and i say the same as for SPC except that : is in place of SPC:

  ::$
  1,1= ,2=,3=,4=,5=,6=,::, ,$

I really would like to finally get a nice mind map on what is
going on everywhere.

Thank you very much in advance,
Ciao (and good night),

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-09-18 21:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-18  1:14 Question on $IFS related differences (Was: Question on $@ vs $@$@) Steffen Nurpmeso
2024-09-18  5:05 ` Oğuz
2024-09-18 11:21   ` Greg Wooledge
2024-09-18 14:48   ` Chet Ramey
2024-09-18 21:37     ` Steffen Nurpmeso
2024-09-18 21:05   ` Steffen Nurpmeso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox