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

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

 



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)




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux