ash does not understand '~'

2003-10-17 Thread Ralf Habacker
Hi,

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


Ralf


--
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/



Re: ash does not understand '~'

2003-10-17 Thread Corinna Vinschen
On Fri, Oct 17, 2003 at 12:19:36PM +0200, Ralf Habacker wrote:
 Hi,
 
 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

The reason is, '~' is an extension to the bourne shell syntax, first
defined in csh or tcsh, AFAIK.  ash is a pure bourne shell with next
to no extensions. Using '~' in a shell script is non-portable.

Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Developermailto:[EMAIL PROTECTED]
Red Hat, Inc.

--
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/



RE: ash does not understand '~'

2003-10-17 Thread Jörg Schaible
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] [EMAIL PROTECTED] \[\033[33m\w\033[0m\]
$ cd /
\[\033]0;\w\007
\033[1m\]\[\033[34m\][$SHLVL] [EMAIL PROTECTED] \[\033[33m\w\033[0m\]
$ cd ~
cd: can't cd to ~
\[\033]0;\w\007
\033[1m\]\[\033[34m\][$SHLVL] [EMAIL PROTECTED] \[\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/



Re: ash does not understand '~'

2003-10-17 Thread Corinna Vinschen
On Fri, Oct 17, 2003 at 12:37:10PM +0200, J?rg Schaible wrote:
 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

Beep.  Wrong.  It knows [ ]

Corinna

 and you cannot combine export with an assignment, you have to write separate 
 statements:
 
 VARIABLE=test
 export VARIABLE

Beep.  Wrong, too.  export var=value is a vaild bourne shell syntax.

Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Developermailto:[EMAIL PROTECTED]
Red Hat, Inc.

--
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/



AW: ash does not understand '~'

2003-10-17 Thread Ralf Habacker
Hi

  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
 
 The reason is, '~' is an extension to the bourne shell syntax, first
 defined in csh or tcsh, AFAIK.  ash is a pure bourne shell with next
 to no extensions. Using '~' in a shell script is non-portable.
 
Thanks, there is always something new to learn :-)

Ralf 


--
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/



RE: ash does not understand '~'

2003-10-17 Thread Jörg Schaible
Corinna Vinschen wrote on Friday, October 17, 2003 1:04 PM:
 On Fri, Oct 17, 2003 at 12:37:10PM +0200, J?rg Schaible wrote:
 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
 
 Beep.  Wrong.  It knows [ ]
 
 Corinna
 
 and you cannot combine export with an assignment, you have to write
 separate statements: 
 
 VARIABLE=test
 export VARIABLE
 
 Beep.  Wrong, too.  export var=value is a vaild bourne shell syntax.
 
 Corinna

Did that change at some point? I remember having really big problems writing scripts 
running on a on Solaris, Linux and Cygwin some years ago g and IIRC it was basically 
because of ash at that time ...

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/



Re: ash does not understand '~'

2003-10-17 Thread Brian Dessent
Jörg Schaible wrote:
 
 Corinna Vinschen wrote on Friday, October 17, 2003 1:04 PM:
  On Fri, Oct 17, 2003 at 12:37:10PM +0200, J?rg Schaible wrote:
  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
 
  Beep.  Wrong.  It knows [ ]
 
  Corinna

 Did that change at some point? I remember having really big problems writing scripts 
 running on a on Solaris, Linux and Cygwin some years ago g and IIRC it was 
 basically because of ash at that time ...
 

I thought this was resolved by making '/bin/[' a symlink to /bin/test. 
This gives the appearance of the shell supporting [ ] even though it's
really just running a program just as if you had used 'test'.

Brian

--
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/



Re: ash does not understand '~'

2003-10-17 Thread Ronald Landheer-Cieslak
On Fri, Oct 17, 2003 at 05:48:12AM -0700, Brian Dessent wrote:
 Jörg Schaible wrote:
  
  Corinna Vinschen wrote on Friday, October 17, 2003 1:04 PM:
   On Fri, Oct 17, 2003 at 12:37:10PM +0200, J?rg Schaible wrote:
   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
  
   Beep.  Wrong.  It knows [ ]
  
   Corinna
 
  Did that change at some point? I remember having really big problems writing 
  scripts running on a on Solaris, Linux and Cygwin some years ago g and IIRC it 
  was basically because of ash at that time ...
  
 
 I thought this was resolved by making '/bin/[' a symlink to /bin/test. 
 This gives the appearance of the shell supporting [ ] even though it's
 really just running a program just as if you had used 'test'.
How does that take care of the closing `]' ?

rlc

-- 
No-one would remember the Good Samaritan if he had only had good
intentions.  He had money as well.
-- Margaret Thatcher

--
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/



Re: ash does not understand '~'

2003-10-17 Thread Corinna Vinschen
On Fri, Oct 17, 2003 at 03:46:16PM +0200, Ronald Landheer-Cieslak wrote:
 On Fri, Oct 17, 2003 at 05:48:12AM -0700, Brian Dessent wrote:
  I thought this was resolved by making '/bin/[' a symlink to /bin/test. 
  This gives the appearance of the shell supporting [ ] even though it's
  really just running a program just as if you had used 'test'.
 How does that take care of the closing `]' ?

The test(1) sources are your friend ;-)

The above isn't true for ash but test(1) is able to work that way.

Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Developermailto:[EMAIL PROTECTED]
Red Hat, Inc.

--
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/



Re: ash does not understand '~'

2003-10-17 Thread Brian Dessent
Ronald Landheer-Cieslak wrote:

  I thought this was resolved by making '/bin/[' a symlink to /bin/test.
  This gives the appearance of the shell supporting [ ] even though it's
  really just running a program just as if you had used 'test'.
 How does that take care of the closing `]' ?

Presumably it looks at argv and if invoked as [ it knows to ignore the
closing ].

Brian

--
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/



Re: ash does not understand '~'

2003-10-17 Thread Christopher Faylor
On Fri, Oct 17, 2003 at 02:36:54PM +0200, J?rg Schaible wrote:
Corinna Vinschen wrote on Friday, October 17, 2003 1:04 PM:
 On Fri, Oct 17, 2003 at 12:37:10PM +0200, J?rg Schaible wrote:
 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
 
 Beep.  Wrong.  It knows [ ]
 
 Corinna
 
 and you cannot combine export with an assignment, you have to write
 separate statements: 
 
 VARIABLE=test
 export VARIABLE
 
 Beep.  Wrong, too.  export var=value is a vaild bourne shell syntax.

Did that change at some point?  I remember having really big problems
writing scripts running on a on Solaris, Linux and Cygwin some years
ago g and IIRC it was basically because of ash at that time ...

It must have changed because I recally ash not accepting that syntax,
too and I know that older versions of /bin/sh don't like it.  ash does
understand it now, though.

cgf

--
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/



Re: ash does not understand '~'

2003-10-17 Thread Andrew DeFaria
Corinna Vinschen wrote:

On Fri, Oct 17, 2003 at 12:19:36PM +0200, Ralf Habacker wrote:

Hi,

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
The reason is, '~' is an extension to the bourne shell syntax, first 
defined in csh or tcsh, AFAIK. ash is a pure bourne shell with next to 
no extensions. Using '~' in a shell script is non-portable.
Non-protable to such OSes that don't have a more modern shell then 
Bourne/Ash I guess. Are there any OSes that don't support shells like 
csh, tcsh, ksh, bash?



--
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/


RE: ash does not understand '~'

2003-10-17 Thread Hannu E K Nevalainen
 From: Andrew DeFaria
 Sent: Friday, October 17, 2003 5:36 PM

OS wars begin(?) - Please, do not!

 Non-protable to such OSes that don't have a more modern shell then
 Bourne/Ash I guess. Are there any OSes that don't support shells like
 csh, tcsh, ksh, bash?

 Old info; AmigaOS had(has) very little support for fork() as all of the OS
ran(runs) in the same memory space (under special circumstanses there was a
vfork() though; see geekgadgets below. In addition to the lightweight
threads that were/are standard).

 bash, and might I guess - most of those above, are/is littered with fork()
calls IIUC (I have not looked).

 I'm not too sure if fork()-use is to be considered state of the art and
thus make a containing project be considered modern.
Without really knowing I would have thought better of such projects if
they'd used pthreads or some such instead. [ This statement is based on
basic OS theory taught at university college in Sweden at least ]

IMO your modern shell statement above is about the same as was stating
DOS compatible a number of years ago. [BG: 640K ought to be enough...]


About AmigaOS:
 There was(is) a pdksh available though. It was(is) included in the
geekgadgets unix emulation project.
Yes, geekgadgets was the same for AmigaOS as cygwin currently is for
Windows.

 I believe Fred Fish is well known to former cygnus.com and gdb people? He
was the initiatior(?) of geekgadgets, at least he held his hand on it for a
long time.

Actually this project still exists, but has a very low profile as most of
its users and maintainers are gone.

/Hannu E K Nevalainen, B.Sc. EE - Amiga user since '85 (the beginning)
-- printf(Timezone: %s\n, (DST)?UTC+02:UTC+01); --
--END OF MESSAGE--


--
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/



Re: ash does not understand '~'

2003-10-17 Thread Igor Pechtchanski
On Fri, 17 Oct 2003, Corinna Vinschen wrote:

 On Fri, Oct 17, 2003 at 12:19:36PM +0200, Ralf Habacker wrote:
  Hi,
 
  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

 The reason is, '~' is an extension to the bourne shell syntax, first
 defined in csh or tcsh, AFAIK.  ash is a pure bourne shell with next
 to no extensions. Using '~' in a shell script is non-portable.

 Corinna

FWIW, the export VAR=VALUE syntax is also non-portable, and was
introduced in ksh.  In sh, VAR=VALUE; export VAR should be used.
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski, Ph.D.
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster.  -- Patrick Naughton

--
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/



Re: ash does not understand '~'

2003-10-17 Thread Andrew DeFaria
Hannu E K Nevalainen wrote:

From: Andrew DeFaria
Sent: Friday, October 17, 2003 5:36 PM
   

OS wars begin(?) - Please, do not!
 

Non-protable to such OSes that don't have a more modern shell then Bourne/Ash I guess. Are there any OSes that don't support shells like csh, tcsh, ksh, bash?
   

Old info; AmigaOS had(has) very little support for fork() as all of the OS ran(runs) in the same memory space (under special circumstanses there was a vfork() though; see geekgadgets below. In addition to the lightweight threads that were/are standard).

bash, and might I guess - most of those above, are/is littered with fork() calls IIUC (I have not looked).

I'm not too sure if fork()-use is to be considered state of the art and thus make a containing project be considered modern. Without really knowing I would have thought better of such projects if they'd used pthreads or some such instead. [ This statement is based on basic OS theory taught at university college in Sweden at least ]

IMO your modern shell statement above is about the same as was stating DOS compatible a number of years ago. [BG: 640K ought to be enough...]

About AmigaOS:
There was(is) a pdksh available though. It was(is) included in the geekgadgets unix 
emulation project.
Yes, geekgadgets was the same for AmigaOS as cygwin currently is for Windows.
I believe Fred Fish is well known to former cygnus.com and gdb people? He was the initiatior(?) of geekgadgets, at least he held his hand on it for a long time.

Actually this project still exists, but has a very low profile as most of its users and maintainers are gone.

/Hannu E K Nevalainen, B.Sc. EE - Amiga user since '85 (the beginning)
-- printf(Timezone: %s\n, (DST)?UTC+02:UTC+01); --
--END OF MESSAGE--
I'm not that concerned about Amiga OS. Honestly I don't know much about 
it. Is it even Unix like?
--
A flashlight is a case for holding dead batteries.



--
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/


RE: ash does not understand '~'

2003-10-17 Thread Hannu E K Nevalainen
 From: Andrew DeFaria
 Sent: Friday, October 17, 2003 9:20 PM

 Hannu E K Nevalainen wrote:

 From: Andrew DeFaria
 Sent: Friday, October 17, 2003 5:36 PM
 
 OS wars begin(?) - Please, do not!
 
 Non-protable to such OSes that don't have a more modern shell
 then Bourne/Ash I guess. Are there any OSes that don't support
 shells like csh, tcsh, ksh, bash?
 
SNIP
 bash, and might I guess - most of those above, are/is littered
 with fork() calls IIUC (I have not looked).
 
 I'm not too sure if fork()-use is to be considered state of the
 art and thus make a containing project be considered modern.
 Without really knowing I would have thought better of such
 projects if they'd used pthreads or some such instead. [ This
 statement is based on basic OS theory taught at university
 college in Sweden at least ]
 
 IMO your modern shell statement above is about the same as was
 stating DOS compatible a number of years ago. [BG: 640K ought
 to be enough...]

SNIP
 I'm not that concerned about Amiga OS.

 I'm not surprised.

 Did you even read what I've left unsnipped above, which was my main point.
The Amiga references was given as an _example_ of an OS where bash et al are
_HARD_ to port, others may well exists, this was the one *I* knew about.

 Honestly I don't know much about it. Is it even Unix like?

 More so than D.O.S. (i.e. cmd/command) is. Given the contents of
geekgadgets the unix-likeness is or could be at the same level as cygwin
provides - in some areas better, others lesser. ('could be' as the
development has stopped)

 Well - whatever, this os OT. :-] lets stop it.

/Hannu E K Nevalainen, B.Sc. EE - 59?16.37'N, 17?12.60'E
-- printf(Timezone: %s\n, (DST)?UTC+02:UTC+01); --
--END OF MESSAGE--


--
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/



Re: ash does not understand '~'

2003-10-17 Thread Andrew DeFaria
Hannu E K Nevalainen wrote:

I'm not that concerned about Amiga OS.
   

I'm not surprised.

Did you even read what I've left unsnipped above, 

I glanced at it. Even went on line and googled around for Amiga OS a 
little. Too much info too little time. As I said I'm not that concerned 
about Amiga OS that much. Ancient OSes are of little interest to me 
except as historical reading...

which was my main point. The Amiga references was given as an _example_ of an OS where bash et al are _HARD_ to port, others may well exists, this was the one *I* knew about.
 

Honestly I don't know much about it. Is it even Unix like?
   

More so than D.O.S. (i.e. cmd/command) is. 

Who ever said that DOS was unix like!?! Hell we aren't discussing 
whether or not ~ is understood by DOS (cmd/command)!?!

Given the contents of geekgadgets the unix-likeness is or could be at the same level as cygwin
provides - in some areas better, others lesser. 

Then it should therefore sport a modern shell that at least understands 
~, no?

('could be' as the development has stopped)

Sorta like Latin, eh?

Well - whatever, this os OT. :-] lets stop it.

But it's fun! :-)

I know, I know, old habits die hard and that is essentially my point. I 
remember one time complaining about HP-UX not recognizing the backspace 
key when logging into a tty. Old timers there quickly told me that del = 
backspace which, to me at the time, was totally weird. Why put a key on 
a keyboard labelled backspace which does not do backspace?!? Why have 
del do a backspace instead?

One old timer piped up Well in the old days sonny! [embellishing here a 
little bit] we only had teletypes and if you looked at a the keys there 
the DEL key was a lot easier to hit than the backspace key to which I 
gave a puzzled grin and replied Who's using teletypes anymore?.

Another old timer remarked that the user could actually want a backspace 
in their password to which I could think of two responses: 1) What if 
they wanted DEL? and 2) If they are wierd enough to want a backspace 
in their password then they should have to escape it!.

OK, I had my quota of fun for this Friday. See y'all next week! :-)
--
I used up all my sick days, so I'm calling in dead.


--
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/


RE: ash does not understand '~'

2003-10-17 Thread Hannu E K Nevalainen
 From: Andrew DeFaria
 Sent: Saturday, October 18, 2003 12:04 AM

 Hannu E K Nevalainen wrote:

 I'm not that concerned about Amiga OS.

  I'm not surprised.
 
 Did you even read what I've left unsnipped above,
 
 I glanced at it. Even went on line and googled around for Amiga OS a
 little. Too much info too little time. As I said I'm not that concerned
 about Amiga OS that much. Ancient OSes are of little interest to me
 except as historical reading...

 Had you googled more, you might had come up with something not so ancient
but still Amiga related. (e.g. AROS) Well, let's leave it here...

 Honestly I don't know much about it. Is it even Unix like?
 
 More so than D.O.S. (i.e. cmd/command) is.
 
 Who ever said that DOS was unix like!?! Hell we aren't discussing
 whether or not ~ is understood by DOS (cmd/command)!?!

 ;-) you asked about beeing unix like, you got an answer.

 Given the contents of geekgadgets the unix-likeness is or
 could be at the same level as cygwin
 provides - in some areas better, others lesser.
 
 Then it should therefore sport a modern shell that at least understands
 ~, no?

 Yes, pdksh.
But now we're back here gain, I do not agree to modern shell beeing an
apropriate statement. shell's are ancient, built with ancient methods (i.e.
fork() ). They're very useful and whatever you can think of, but not modern,
just ancient.

 Well - whatever, this os OT. :-] lets stop it.
 
 But it's fun! :-)

 =-)

/Hannu E K Nevalainen, B.Sc. EE - 59?16.37'N, 17?12.60'E
-- printf(Timezone: %s\n, (DST)?UTC+02:UTC+01); --
--END OF MESSAGE--


--
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/