(a) Write a shell script that displays a list of all files in the current directory to which the user has read write and execute permissions
(b) Develop an interactive script that asks for a word and file name and then tells how many times that word occurred in the file.
(c) Write a shell script to perform the following string operations.
1) To extract a sub string from a given string
2) To find the length of a given string
# File Name : list.sh
read -p "Enter a directory name : " dn
if [ -d $dn ]; then
printf "\nFiles in the directory $dn are :\n"
for fn in `ls $dn`
if [ -d $dn/$fn ]; then
printf "<$fn> Directory "
elif [ -f $dn/$fn ]
printf "$fn File "
if [ -r $dn/$fn ]; then
printf " Read"
if [ -w $dn/$fn ];then
printf " Write"
if [ -x $dn/$fn ];then
printf " Execute"
printf "\n$dn not exists or not a directory"
# File Name : wcount.sh
read -p "Enter a file name : " fn
if test -f $fn
echo "The contents of the file $fn is :"
echo "No. of Line : `wc -l $fn`"
echo "No. of Words : `wc -w $fn`"
echo "No. of Characters: `wc -c $fn`"
echo "$fn is not exists or not a file"
Print “Enter the String:\c”
print the string length is : $strlen
Enter the String: Now is the time
The String length : 15