mirror of https://github.com/01-edu/public.git
eslopfer
2 years ago
1 changed files with 38 additions and 0 deletions
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash |
||||
|
||||
# Check if the script was given an argument |
||||
if [ $# -ne 1 ] |
||||
then |
||||
echo "Error: a file must be provided as an argument" |
||||
exit 1 |
||||
fi |
||||
|
||||
# Check if file exists |
||||
if [ ! -e "$1" ] |
||||
then |
||||
echo "File does not exist" |
||||
else |
||||
echo "File exists" |
||||
fi |
||||
|
||||
# Check file's permissions |
||||
if [ -r "$1" ] |
||||
then |
||||
echo "File is readable" |
||||
else |
||||
echo "File is not readable" |
||||
fi |
||||
|
||||
if [ -w "$1" ] |
||||
then |
||||
echo "File is writable" |
||||
else |
||||
echo "File is not writable" |
||||
fi |
||||
|
||||
if [ -x "$1" ] |
||||
then |
||||
echo "File is executable" |
||||
else |
||||
echo "File is not executable" |
||||
fi |
Loading…
Reference in new issue