Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zpty woes



On Thu, May 15, 2008 at 08:02:04AM -0400, Jaime Vargas wrote:
[...]
> zpty -t scppty || echo "something went wrong" && exit
[...]

That would always exit unless echo returned with a non-zero exit
status

A || B && C

must be read

(A || B) && C

So C is executed if either A or B succeeds.

You should write it:

A || {
  B
  C
}

or

if ! A; then
  B
  C
fi

or

die() {print -r -- $1 >&2; exit 1;}
A || die "something wrong"

-- 
Stéphane



Messages sorted by: Reverse Date, Date, Thread, Author