View Single Post
  #5   (View Single Post)  
Old 21st August 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
ISO Quartermaster
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 589
Default

Quote:
Originally Posted by vermaden View Post
O RLY?
Code:
if [ ! -f file ]; then
  echo "file does not exist"
fi

if [ ! -d dir ]; then
  echo "dir does not exist"
fi
even shorter:

Code:
[ ! -f file ] && echo "file does not exist"
[ ! -d dir ] && echo "dir does not exist"

Here:
http://developer.apple.com/documenta...ShellScripting
http://developer.apple.com/documenta...lScripting.pdf
http://tldp.org/LDP/abs/html/
Thanks
I did tried -!f -f!, didn't thought about trying ! -f
Reply With Quote