View Single Post
  #4   (View Single Post)  
Old 21st August 2008
vermaden's Avatar
vermaden vermaden is offline
Administrator
 
Join Date: Apr 2008
Location: pl_PL.lodz
Posts: 1,056
Default

Quote:
Originally Posted by killasmurf
I know already that.
O RLY?

So why do you ask:
Quote:
Originally Posted by killasmurf
How to check in sh if file/directory exists (using if)?
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"
Quote:
Originally Posted by killasmurf
Also can someone suggest a Good sh tutorial... i came across few, but they are very basic
Here:
http://developer.apple.com/documenta...ShellScripting
http://developer.apple.com/documenta...lScripting.pdf
http://tldp.org/LDP/abs/html/
__________________
religions, worst damnation of mankind
"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds

Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.
vermaden's: links resources deviantart spreadbsd
Reply With Quote