Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 #!/bin/bash
- 2
- 3 #
- 4 #
- 5 #
- 6
- 7 if [ -z $1 ]
- 8 then
- 9 echo no argument
- 10 exit 2
- 11 elif [ ! -e $1 ]
- 12 then
- 13 echo unknown argument
- 14 exit 3
- 15 elif [ -d $1 ]
- 16 then
- 17 echo it\'s a directory
- 18 # at this point it must be a file, let's find out what type of file
- 19 elif [ ! -f $1 ]
- 20 then
- 21 echo some special file
- 22 elif [ -x $1 ]
- 23 then
- 24 echo executable file
- 25 elif grep '#!/bin/bash' $1
- 26 then
- 27 echo it\'s a bash file that is not executable yet
- 28 chmod +x $1
- 29 else
- 30 echo this is a non-executable file it appears
- 31 fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement