jeudi 8 janvier 2015

Is field splitting and filename expansion turn off in RHS of variable assignment portable?


In most POSIX shells like bash. ksh, dash, mksh, pdksh, when variable assignment occur, field splitting and filename expansion (and brace expansion if the shell supports) are not performed in RHS of assignment:



$ IFS=/
$ a=1/2
# Field splitting and filename expansion turned off here
$ b=$a
$ IFS=
$ printf '%s\n' $b
1/2


Some shell's documentation (bash, ksh) mentioned about this, but POSIX documentation didn't.


I can see this behavior in most POSIX shells, so I wonder is it portable since when POSIX documentation does not specify it?



Aucun commentaire:

Enregistrer un commentaire