Re: csh question: foreach

From: Colin B. (cbigam_at_somewhereelse.nucleus.com)
Date: 10/21/04


Date: Thu, 21 Oct 2004 15:12:09 GMT

In comp.unix.solaris Stephane CHAZELAS <this.address@is.invalid> wrote:
> 2004-10-20, 18:35(+00), Colin B.:
> [...]
>> ksh vs. bash (i.e. the "sh-like shells")
>> ksh is /bin/sh compatible. bash isn't. End of story.
> [...]
>
> ???
>
> Could you please expand on that? Note that "/bin/sh" can be a
> wide variety of things including ksh, bash, zsh, a ash
> derivative or even in some rare cases now a Bourne shell (which
> is the case though on comp.unix.solaris where this is
> crossposted to).

Fair enough. Since I spend most of my time on Solaris, I tend to use
/bin/sh as shorthand for bourne shell.

> ksh is no more nor less compatible with the Bourne shell than
> bash if it's what you meant.

No, that's not what I meant at all. Try this:
$ echo "error!"

To the best of my knowledge, there is no way to make bash behave the same
way as sh in this case. No, it's not posix-compliant, but it IS used, and
is expected. ksh and zsh both can deal gracefully with it--why not bash?

> csh is as much far behind tcsh as let's say ksh is behind zsh.
> I'd bet you never used neither tcsh nor zsh.

I have used both of them. The end result is still that ksh does everything
I need as a command-line shell, and does it efficiently. If I need something
more powerful than ksh (rarely), I start to look at perl.

> Talking of "/bin/sh" syntax nowadays doesn't make any sense
> (from a Unix point of view).

OK then. ksh and zsh can both be invoked to behave exactly the same as
the bourne shell. bash can not, unless that's changed quite recently.

Colin



Relevant Pages

  • Re: .bashrc aliases
    ... In bash, you can use 'function' instead of 'alias' which pretty much ... that's neither the ksh nor the Bourne ... Then the Bourne shell chose to write it as: ... The POSIX and UNIX specification only recognise the Bourne way. ...
    (comp.unix.shell)
  • Re: OT: The Straight Dope
    ... > know about bash, ksh, or sh. ... I believe the Bourne shell is where the backticks as "execute string ... C-shell programming generally seems to be deprecated in most ...
    (comp.lang.python)
  • Re: POSIX Shell and Parameter Expansion
    ... Is it a correct shell token? ... If you have a look into the respective syntax description of ksh, e.g., ... bash: x: huh ... zsh: x: huh ...
    (comp.unix.shell)
  • Re: Bourne Shell: scope of variables in while loop
    ... bash, zsh, and ksh, in treating redirection caused by the redirection ... AT&T ksh run the rightmost part in the current shell process, ... control structure, apparently I never attempted to use any of the ...
    (comp.unix.shell)
  • Re: csh question: foreach
    ... /bin/sh as shorthand for bourne shell. ... > bash if it's what you meant. ... ksh and zsh both can deal gracefully with it--why not bash? ...
    (comp.unix.solaris)