I was given homework where I need to test if
$1
is a file, special file or a folder in a **Case $1
In statement**.
I tried some things but wasn't able to make it work. Do you have any idea on how to implement this (in a case statement)
What I need to achieve is :
if [ -f $1 ]
then
exit 1
elif [ -d $1 ]
then
exit 2
elif [ -c $1 -o -b $1 ]
then
exit 3
else
exit 0
fi
I'm not asking for the final code, just a way to make the following work:
Case $1 in
-d) ...
Asked by JeanneD4RK
(161 rep)
Dec 10, 2015, 07:06 PM
Last activity: Feb 18, 2024, 07:47 PM
Last activity: Feb 18, 2024, 07:47 PM