I keep wondering about strange rules of parameter expansion in shell.
If I declare
NUMBERS=" one two "
and if execute the following (note that there is no space between variable and the constant string.)
echo ${NUMBERS}'and three'
Bash (along with Dash and Kornshell) echoes:
one two and three
However, the same output is echoed with:
echo ${NUMBERS} 'and three'
I was under impression that according to 2.6.5 Field Splitting rules, 3a, the IFS whitespace should be ignored at the beginning and at the end of the input while expanding the NUMBERS
variable.
Why does the shell at one occasion put the space between the expansion and the constant string and at other times not?
echo "${NUMBERS}'and three'"