View Single Post
  #3   (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
Code:
if [ -f file ]; then
  echo "file exists"
fi

if [ -d dir ]; then
  echo "dir exists"
fi
I know already that.
and i can use else to do things i want if file doesn't exist...
Code:
if [ -d dir ]; then
  echo "dir exists"
else
  echo "dir doesn't exist"
fi
but is there a way to do it straight
cause i need action only if it doesn't exist (If doesn't exist, then do this and that)
Reply With Quote