Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: A short form for if-then-else
- X-seq: zsh-users 14496
- From: Andrey Borzenkov <arvidjaar@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: A short form for if-then-else
- Date: Thu, 15 Oct 2009 20:43:49 +0400
- Cc: Anonymous bin ich <ichbinanon@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:cc:references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=lQsqCDDAIHx58ElwqSslsxSZXBzWpRmSnpdmAt2X4TI=; b=nqMPvSVZ9rQREZeDiV5TNQlOKaa4Ka3iMdABPmfJvQz7/0r3ya1bMRXQfZlRJdYLYV K+YSN5W9L5rDQqcJoLrakSSPXiGZ6oJB+k10AWnx7rFt59BpSIx7Y2oAZag45hFpH3GQ U3mR6tUAzh0SzFp00rCBwuVv+MA1oV0+JTsm0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=nE7u4wSoTbyA9mJljo+dqDEyjIf8x8+gNK/ulucId9lmRqAK2bUEZwquyG25c6fCUV 9usSzZ974BDKjxagkJmLc9oR1gbD9BluAtaIujZ6DDLqxHVlwQXDG2QzG/NScUhHfvGb KtOPGE6a66A8RFwbWCXj28E9+6GzkLcvcn+SM=
- In-reply-to: <82839db60910150936o1d75fd27u80bd3aa41143f1c@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <82839db60910150936o1d75fd27u80bd3aa41143f1c@xxxxxxxxxxxxxx>
On Thursday 15 of October 2009 20:36:50 Anonymous bin ich wrote:
> 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
>
if which mailx > /dev/null; then ...
Attachment:
signature.asc
Description: This is a digitally signed message part.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author