DISPLAY FILE TYPE


SOURCE CODE:
read i
if [ -f $i ]
then
echo “ It is an ordinary file ”
elif [ -d $i ]
then
echo “ It is a directory file ”
else
echo “ It does not exist  ”
fi

OUTPUT:
[examuser35@localhost Jebastin]$ sh type.sh
a
It is a directory file
[examuser35@localhost Jebastin]$ sh big.sh
It is an ordinary file
[examuser35@localhost Jebastin]$ sh i.sh
It does not exist
Previous
Next Post »

Still not found what you are looking for? Try again here.