- Joined
- Dec 16, 2006
- Messages
- 33
- Reaction score
- 0
- Points
- 6
Hi Guys
I have a shellscript that is located in my $Home directory, when executed it changes to a directory called "Progs" (/$Home/Progs).
then after user input from myself it searches for another shellscript (there are a few) in that directory and if it doesn't find it it returns an error message.
What I want to achieve is how do i extend my if statement to get it to search in another directory within Progs called Extra (/$Home/Progs/Extra) if the shell script isnt found in Progs and only if the shell script isnt in Extra the script returns an error message.
My if statement looks like this:
I've set it up so I don't have to type ./scriptname.sh, only scriptname
Any help would be appreciated
I have a shellscript that is located in my $Home directory, when executed it changes to a directory called "Progs" (/$Home/Progs).
then after user input from myself it searches for another shellscript (there are a few) in that directory and if it doesn't find it it returns an error message.
What I want to achieve is how do i extend my if statement to get it to search in another directory within Progs called Extra (/$Home/Progs/Extra) if the shell script isnt found in Progs and only if the shell script isnt in Extra the script returns an error message.
My if statement looks like this:
echo -n "Enter Command: "
read FILE
FILE=${FILE}".sh"
if [ -f ${FILE} ]; then
./${FILE}
else
echo "File not found."
fi
read FILE
FILE=${FILE}".sh"
if [ -f ${FILE} ]; then
./${FILE}
else
echo "File not found."
fi
I've set it up so I don't have to type ./scriptname.sh, only scriptname
Any help would be appreciated