Bash tip

William Park opengeometry-FFYn/CNdgSA at public.gmane.org
Sat Mar 27 23:11:10 UTC 2004


On Sat, Mar 27, 2004 at 05:59:15PM -0500, James Knott wrote:
> I have discovered a simple method for conditionally running a command, 
> depending on if a file exists.
> 
> When you want to run a command, when a file exists, the usual form has 
> been something along the lines of:
> 
> if [ -x aaa ]; then
>   bbb
> fi
> 
> However, I've noticed that you can also use
> 
> ls aaa && bbb

This is equivalent to
    [ -e aaa ] && bbb
A better analogy is
    [ -x aaa ] && bbb

-- 
William Park, Open Geometry Consulting, <opengeometry-FFYn/CNdgSA at public.gmane.org>
Linux solution for data processing and document management.
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list