Advertisement
FranzVuttke

check_file_exists

Nov 19th, 2023 (edited)
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. #
  4. # by OuNiS 11.2023
  5. #
  6. # man test to check IF statement
  7. #
  8. # if [ -n $1 ] ; then
  9. if test -n "$1"  ; then
  10. # if [ -s $1 ] ; then
  11.     if test -s "$1"  ; then
  12.         echo "'$1' - exists..."
  13.     else
  14.         bell
  15.         echo "'$1' - not exists..."
  16.     fi
  17. else
  18.     bell
  19. # https://stackoverflow.com/questions/24980679/double-exclamation-in-bash-scripthttps://stackoverflow.com/questions/24980679/double-exclamation-in-bash-script
  20.     echo ERR: missing parameter \!\!\!
  21.    
  22.     echo "How to use?:"
  23.     echo -e "\tcheck_file_exists <file_location>"
  24. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement