Determine if file exists in a Bourne/bash shell script

Home -> Programming -> Shell script -> Bourne shells

69099 views

From the computer of: Rex (39 recipes)
Created: Oct 20, 2003     Updated: Aug 30, 2004


Add a comment

Add to:
Add to stumbleuponAdd to del.icio.usDigg itAdd to FURL

if [ -f testfile ]
then
  echo testfile exists!
fi

Subscribe to the Tech-Recipes Newsletter

You can get tips like this delivered in your email every week!

Enter your Email

We will never, ever sell your email address or spam you.





Related recipes:

  Determine if a file is writable by a Bourne script user
  Determine if a file is readable by current Bourne shell script user
  Bourne/bash shell script functions
  Bourne/bash shell script for loop syntax
  Bourne/bash shell scripts: case statement
  Bourne/bash shell script: while loop syntax
  Bourne/bash shell scripts: if statement syntax
  Hide password entry in Bourne/bash shell script
  Bourne/bash shell scripts: string comparison
  bash shell script iterate through array values

 

Sponsored links

 

Login

Nickname

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.