On Sun, 15 Sep 2002, Jan Mason wrote:
> Test case 2 output:
>
> $ green
> prompt for dir: ~
> dir = ~
> /home/jan/bin
> /home/jan/bin/green: cd: ~: No such file or directory
> /home/jan/bin
This will never work unless you code your script to do the substitution.
The issue here is that your interactive shell is doing the substitution of
~ for $HOME for you when you pass ~ on the command line to green.
However, you are no longer in that interactive shell when you are being
prompted to enter ~ on your own.
In your section
echo -n "prompt for dir: "
read directory
you need to add
directory=`echo $directory | sed -e s!~!$HOME!`
for your script to work correctly.
Paul Braman
aeon@tampabay.rr.com
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:36:20 EDT