roland@AI.MIT.EDU (Roland McGrath) (06/26/89)
The evaluation order of ~ vs $ is not like csh's. Maybe this is wrong? For example, in bash: foo='~/bin' echo $foo ~/bin echo ~/bin /gp/fsf/roland/bin In csh: set foo='~/bin' echo $foo /gp/fsf/roland/bin
chet@kiwi.CWRU.EDU (Chet Ramey) (06/28/89)
In article <8906270547.AA01124@hobbes.ai.mit.edu> roland@AI.MIT.EDU (Roland McGrath) writes: >The evaluation order of ~ vs $ is not like csh's. Maybe this is wrong? Bash is not csh. All the Bourne-style shells (basically shells that do Bourne-style single quote evaluation) that I have access to that do tilde expansion (bash, ksh, a hacked s5r2 /bin/sh) are consistent. Bash does it right, if sh compatibility is the goal. If you want the csh-style results, assigning to foo without the quotes seems to work. A weirder way to get what you want is this: pirate$ foo='~/bin' pirate$ echo $foo ~/bin pirate$ foo=$(eval echo $foo) pirate$ echo $foo /usr/homes/chet/bin Chet Chet Ramey Network Services Group, CWRU chet@cwjcc.INS.CWRU.Edu "The flagon with the dragon has the potion with the poison; the vessel with the pestle holds the brew that is true!"