Interviews Questions, Algorithms, Aptitude, C Interview Program, C Theory Question, Aptitude Tricks, Test Series,

Friday, 3 May 2019

IOPP Program 4 B

Question:
Write a shell script to search a filename in the current working directory

Solution: 

echo "Enter the filename that u want to search"

read filename
 

c=`pwd`
 

x=`find $c -name "$filename"`
 

y=$c/$filename
 

if [ "$x" = "$y" ]
 

then
 

     echo "Found"
 

else
 

     echo "Not Found"

fi


Credits: Aditya

0 comments:

Post a Comment