Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
A short form for if-then-else
- X-seq: zsh-users 14494
- From: Anonymous bin ich <ichbinanon@xxxxxxxxx>
- To: ZSH User List <zsh-users@xxxxxxxxxx>
- Subject: A short form for if-then-else
- Date: Thu, 15 Oct 2009 18:36:50 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=6bpU4N6W4npwKeSg/tEUSQkBiFp+sVz8gs3ifzjIKHA=; b=slMk0GPCDkVKWP3lMB/5YoSS10FkyIzq9rWgLt7Zmm2rPZemUImL02J8EGl3wgiaNE syShJIIAjzcwVgMWtMvRwB+lL9GV64nPGC29iOmicfjHJH42GeZ7n0dqTKED8sQW0oqo yEKk1rNkQ/L5pyoufe6CsSPv4m/JUXU3qxhBE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=PX62Fy0zw8bRIx4mPxDYQjMNiOHyIt5/p+UHH9KudLPYpS+aTKh/3Kgh5CyU6uD6hX gmsUhwGmyTyoFa+dAQlmOVHUAH96g0y2YDlhW/myoPGX0hryn0zu8ec5TJyEb30/6a9U hK39ZtLNMsfoFakbdk/cCPVxWp43SSl8ixIpc=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Hi!
I want to check if a program (mailx) is present or not. If present,
the program will be run, if not, an error message should be printed.
No other message should be printed.
I have tried following ways:
which mailx &>/dev/null && mailx || echo "not found"
but when mailx exits with non 0 error code, "not found" is printed.
I tried
if [[ -x =mailx ]]; then mailx; else echo "not found"; fi
but when mailx is not present, zsh prints an error which I cannot seem
to redirect to /dev/null
Any other way to do it without involving local variables or different
external programs?
--
Regards,
Messages sorted by:
Reverse Date,
Date,
Thread,
Author