Check if a file exists


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. FILE="/etc/hosts"
  2. if [ -f $FILE ]; then
  3. echo "File ${FILE} exists"
  4. else
  5. echo "File ${FILE} does NOT exists"
  6. fi
  7.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.