bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question on $IFS related differences (Was: Question on $@ vs $@$@)


From: Steffen Nurpmeso
Subject: Question on $IFS related differences (Was: Question on $@ vs $@$@)
Date: Wed, 18 Sep 2024 03:14:43 +0200
User-agent: s-nail v14.9.25-608-ge479530e8d

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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]