🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Roland McGrath Mon, 26 Jun 1989 15:47
evaluation order wrong?
#149
Author: Roland McGrath
Date: Mon, 26 Jun 1989 15:47
16 lines
604 bytes
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
Re: evaluation order wrong?
#155
Author: Chet Ramey
Date: Tue, 27 Jun 1989 17:05
29 lines
1357 bytes
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!"
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads