[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test for "command not found" before expanding shell parameters
From: |
Andreas Schwab |
Subject: |
Re: test for "command not found" before expanding shell parameters |
Date: |
Mon, 21 Apr 2014 11:16:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Alan Young <alansyoungiii@gmail.com> writes:
> greo=$(command -v greo)
>
> if [ -n $greo ]; then
> $greo ...
> fi
>
> command will search the directories defined in $PATH for the command
> greo and return the fully qualified path. If it isn't found it will
> return null. So, if $greo is non-zero, greo exists and you can run
> it.
And if $greo is null the condition will also be true.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."