Advertisement
OldManRiver

Valdi Dir Function

Jun 9th, 2017
134
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. hsn=$(hostname);
  2. vdr=valid_dir "/home/files/Dropbox";
  3. if [ 0 eq $vdr ]; then
  4. echo "Valid Dir!";
  5. d_pth='/home/files/Dropbox/backups/${hsn}';
  6. else
  7. echo "Invalid Dir!";
  8. d_pth="/data/Backups/$hsn";
  9. fi
  10.  
  11. function valid_dir {
  12. DIR="$1"
  13. if [ $# -lt 1 ]; then
  14. return 3;
  15. elif [ ! -d "$DIR" ]; then
  16. return 4;
  17. else
  18. return 0;
  19. fi
  20. } # end funcion valid_dir
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement