ash does not understand '~'
Jörg Schaible
Joerg.Schaible@Elsag-Solutions.com
Fri Oct 17 11:29:00 GMT 2003
Hi Ralf,
Ralf Habacker wrote on Friday, October 17, 2003 12:20 PM:
> the following shell script does not work at least with
> ash-20031007-1 although I don't see any reason why this
> should not be a valid syntax. If you use
>
> export PATH=${HOME}:/usr/bin
>
> then the scripts runs. bash has no problems with this.
>
>
> --- ~/test -------
> #!/bin/sh
> export PATH=~:/usr/bin
> test2
>
> --- ~/test2 -------
> #!/bin/sh
> echo "test2"
ash does not know "~", see:
$ sh
\[\033]0;\w\007
\033[1m\]\[\033[34m\][$SHLVL] \[\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ cd /
\[\033]0;\w\007
\033[1m\]\[\033[34m\][$SHLVL] \[\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ cd ~
cd: can't cd to ~
\[\033]0;\w\007
\033[1m\]\[\033[34m\][$SHLVL] \[\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ exit
BTW: It does also not know the "[ ]" syntax for a built-in test, you always have to use "test":
if test -f /etc/hosts; then
echo "/etc/hosts exist!"
fi
and you cannot combine export with an assignment, you have to write separate statements:
VARIABLE=test
export VARIABLE
Just a short overview over the most common pitfalls :)
Regards,
Jörg
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list