bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test for "command not found" before expanding shell parameters


From: Chet Ramey
Subject: Re: test for "command not found" before expanding shell parameters
Date: Tue, 22 Apr 2014 16:03:29 -0400

> On Mon, Apr 21, 2014 at 3:16 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> > And if $greo is null the condition will also be true.
> 
> Really? <runs quick test> I'll be damned.  That explains this problem
> I've been having.

Yes.  `test' operates based on the number of arguments it receives.  If you
don't quote `$greo' and it expands to nothing, test receives a single
argument (-n), tests it for nullness, and returns success.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]