Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


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

Re: bash if file exists



 Michael Tiernan wrote: 
> ...if you're root, then use: 
> /bin/ls -1 *.zip > /dev/null 2>&1 

You're point being use /bin/ls instead of ls and relying on the path? 
Sure, but explicitly setting the path might be a better idea, if this is 
part of a larger script. 

What's the relevance of the -1 switch if you're throwing away the output? 


> ...if there's too many entries...... 

ls -1 | egrep -q '\.zip$' 

ought to do it. 


Cole Tuininga wrote: 
> I believe that using "echo" instead, would not have such a problem. 

I don't see why. It still depends on passing an argument, which the 
shell expands, on the command line. 

  -Tom 

-- 
Tom Metro 
Venture Logic, Newton, MA, USA 
"Enterprise solutions through open source." 
Professional Profile: http://tmetro.venturelogic.com/

-- 
This message has been scanned for viruses and 
dangerous content by MailScanner, and is 
believed to be clean. 

_______________________________________________ 
Discuss mailing list 
[hidden email] 
http://lists.blu.org/mailman/listinfo/discuss
 


BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org