delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/17/06:37:29

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
content-class: urn:content-classes:message
Subject: RE: ash does not understand '~'
MIME-Version: 1.0
Date: Fri, 17 Oct 2003 12:37:10 +0200
X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0
Message-ID: <F0D7281DAB048B438E8F5EC4ECEFBDDC175F68@esmail.elsag.de>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: =?iso-8859-1?Q?J=F6rg_Schaible?= <Joerg DOT Schaible AT Elsag-Solutions DOT com>
To: "cygwin" <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id h9HAbNUC019777

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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019