zsh-workers
 help / color / mirror / code / Atom feed
* Re: Why does this not work in zsh?
@ 1995-09-25 16:26 Florent Guillaume
  0 siblings, 0 replies; only message in thread
From: Florent Guillaume @ 1995-09-25 16:26 UTC (permalink / raw)
  To: zsh-workers

> >Below follows a nice script, which works with ksh, bash, csh and tcsh,
> >but not with zsh :-((((
> [...]
> Erm, in zsh, you're aliasing both endif and fi to :.  I'm not surprised
> that it doesn't work.  Don't alias fi if you're using zsh.

The real probleme isn't here, it's how zsh treats the "if () then" line.

I also wanted to have a script that worked with all shells, but could
differenciate c shells from bourne shells.  I did this :

if (: != :) then
 ... bourne shell commands
else
 ... c shell commands
 alias fi "unalias fi"
endif
fi

(You'll note the cute little trick on the first line.)

This script work with sh, ksh, bash, csh, tcsh, but NOT with zsh, zsh
doesn't grok the "if () then" syntax (without a semicolon before "then")
which, event if it is nowhere documented, is accepted by sh, ksh and
bash.

For the sake of compatibility, I think this should be fixed.

As an aside, if someone has an idea on how to do what I want to do using
different means, please tell me (the bourne shell command I'm using is
just defining a function setenv, so that the rest of the script can be
processed by all shells ; this means that I can't use a subshell and
redirect its error messages to /dev/null).

-- Florent


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-09-25 16:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-09-25 16:26 Why does this not work in zsh? Florent Guillaume

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).