In one session I have strange behavior of the bash-shell:
SDX-Q> echo ">$ss<" #this is just to present the $ss var:
> lll kkk <
SDX-Q> # more obviose:
SDX-Q> od -cb <<<"$ss"
0000000 l l l k k k \n
040 040 040 154 154 154 040 040 040 040 153 153 153 040 040 012
0000020
SDX-Q>
SDX-Q> # now the strange acting:
SDX-Q> echo $ss
lll kkk
SDX-Q> # but, it should be : "lll kkk"; To show all spaces printed out:
SDX-Q> echo $ss | tr ' ' '.'
...lll....kkk..
SDX-Q>
SDX-Q> # something strange with arrays:
SDX-Q> set -- " aaa " bbb cccc last $ss
SDX-Q> echo "$*"
aaa ~bbb~cccc~last~ lll kkk
SDX-Q> # The '~' are not understandable there and, again,
SDX-Q> # the $ss should not be accepted with spaces!
SDX-Q> echo $*
aaa bbb cccc last lll kkk
SDX-Q> # that is fine, besides, again, the variable $ss
SDX-Q>
SDX-Q> printf "%s\n" "$*"
aaa ~bbb~cccc~last~ lll kkk
SDX-Q> # The same for array ...
SDX-Q>
SDX-Q> printf "%s\n" $*
aaa
bbb
cccc
last
lll kkk
SDX-Q> # that is fine, besides the $ss
So, the main problem is getting a variable as one unit, while it is frequently expected interpolation to pieces.
Could anyone explain what is happened in that session?
Is it possible to make shell acting that way explicitely and, of couse, restore to regular processing way?
Other sessions behaive as expected.
If I start a 'bash' in that one, everything is as expected again.
That way it is not related to the connecting soft: I use PuTTY, btw.
And my OS is SUN Solaris, if that make any difference.
BASH_VERSION='3.00.16(1)-release'
(If anything would be need to be tested, let me know: I keep the session opened.)
Thanks!