#
#Write a script to display the name of all executable files in the given directory
#
clear
echo -n "Enter name of the directory :"
read directory

if [ ! -d $directory ]
then
    echo "Directory not exist"
else
	count=0
	echo "Files with executable rights are"
#ONE SOLULTION IS
#	for i in `ls $directory`
#	do
#		if [ -x $directory/$i ]
#		then
#			echo $i
#		fi		
#		count=$(echo count + 1 | bc -l)
#	done
        for i in $(find $directory -type f -perm +111)
        do
                echo $i
                count=$(echo count + 1 | bc -l)
        done
	if [ $count -eq 0 ]
	then
		echo "No files found with executable rights"
	fi
fi
