0% found this document useful (0 votes)
7 views2 pages

Shell Script for Executable Files

The document provides a shell script to display the names of all executable files in the current directory. It includes multiple variations of the script, utilizing different methods to check for executable files and count them. The scripts use basic shell commands and conditional statements to achieve the desired output.

Uploaded by

for11trade
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Shell Script for Executable Files

The document provides a shell script to display the names of all executable files in the current directory. It includes multiple variations of the script, utilizing different methods to check for executable files and count them. The scripts use basic shell commands and conditional statements to achieve the desired output.

Uploaded by

for11trade
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Script No .

Definition:
Write a shell script to display the name of all the executable file from the current
directory.
Script:
clear
for i in `ls`
do
if [ -x $i ]
then
echo $i
fi
done

OR
countx=0
for i in *
do
if [ -x $i ]
then
countx=`expr $countx + 1`
fi
echo "Number of exetable files are $countx"
done

OR
for i in `ls`
do
if [ -x $i ]
then
echo "$i"
fi
done

You might also like