Xioth

Bash - TD1 - verif.sh

Jan 25th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.34 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ $# -ne 1 ]
  4. then
  5.     echo "Ce programme n'accepte qu'un et un seul argument"
  6.     exit 1
  7. else
  8.     path="$(cd $(dirname $1); pwd)/$(basename $1)"
  9.     total=""
  10.  
  11.     while [ $path != "/" ]
  12.     do
  13.         total="$path $total"
  14.         cd ..
  15.         path=$(pwd)
  16.     done
  17.  
  18.     for t in $total
  19.     do
  20.         if [ ! -e $t ]
  21.         then
  22.             echo "$t n'existe pas"
  23.         fi
  24.     done
  25. fi
Add Comment
Please, Sign In to add comment