Write a shell script to test if the file is an executable or not [OR exists or not/readable(Also display total number of lines, words, characters of file.)]

unix shell script to check file executable or not unix have operator -x -x operator check if file executable or not

code


echo “enter the file name”
read a
if [ -x $a ]
then
echo “executable”
wc $a
else
echo “not executable”
wc $a
fi


output

$bash file.sh enter the file name file1 excutable 22 22 114 file1

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post