I have a find script that works but I was wondering how I can get the output to tell me if the data is a directory.
Example of my output:
./wer
./wer/zzz/wer
if the first 'wer' is a directory I want it to output like this:
./wer IS A DIRECTORY
./wer/zzz/wer
Here is my script and I know I can fetch a directory with something like this:
(substr($1,1,1) == "d"
but I dont know how to put it in my script.
[tt]
#!/bin/ksh
echo "Enter the file you want to find"
read dat
echo "Searching `pwd` for $dat...."
sleep 1
find . -name "$dat" -print > rock
i=`ls -l rock | awk '{print $5}'`
if [ $i == 0 ]
then
print "\nNot found\n"
else
print
cat rock
print
fi
print "End of search"
rm rock [/tt]
Example of my output:
./wer
./wer/zzz/wer
if the first 'wer' is a directory I want it to output like this:
./wer IS A DIRECTORY
./wer/zzz/wer
Here is my script and I know I can fetch a directory with something like this:
(substr($1,1,1) == "d"
[tt]
#!/bin/ksh
echo "Enter the file you want to find"
read dat
echo "Searching `pwd` for $dat...."
sleep 1
find . -name "$dat" -print > rock
i=`ls -l rock | awk '{print $5}'`
if [ $i == 0 ]
then
print "\nNot found\n"
else
cat rock
fi
print "End of search"
rm rock [/tt]