I'm attempting to write a script that will search a particular directory and a set of files though a set of line arguments.
Example:
$script /usr/bin/ksh file1 file2 ..... file[n]
I want it to echo the path name and the file name. If the directory doesn't exist then I want it to echo "incorrect directory". If the file(s) are wrong then I want it to echo which argument is incorrect.
Here is what I have so far:
#! /bin/ksh
if test -d $1
then
directory=$1
shift
for file in $*
do
find $directory -name $file -print
done
else
echo "The directory of $1 could not be located."
echo "Please try a different directory"
echo
fi
This script works fine if the directory is incorrect. But what if the files are incorrect. Right now it doesn't say a thing.
Any Thoughts?
MagnumVP
Example:
$script /usr/bin/ksh file1 file2 ..... file[n]
I want it to echo the path name and the file name. If the directory doesn't exist then I want it to echo "incorrect directory". If the file(s) are wrong then I want it to echo which argument is incorrect.
Here is what I have so far:
#! /bin/ksh
if test -d $1
then
directory=$1
shift
for file in $*
do
find $directory -name $file -print
done
else
echo "The directory of $1 could not be located."
echo "Please try a different directory"
echo
fi
This script works fine if the directory is incorrect. But what if the files are incorrect. Right now it doesn't say a thing.
Any Thoughts?
MagnumVP