I've tried ths again and still no luck getting it to work. The name of the script is findit. I dropped the \c in the first echo since it didn't seem to keep cursor on the same line and also added spaces within brackets, like this [ $pname = "" ].
My script looks like this now.
#!/bin/sh
printf "Enter a file to search for: "
read pname
if [ $pname = "" ]; then
echo "You must enter a file to search for!"
echo "press any key to continue ..."
read press
clear
./findit
fi
else
echo "Searching for $pname ..."
find / -name "$pname"
echo "Press any key to continue ..."
read press
fi
When I execute this script and don't type anything in and press enter. It works correctly and tells me "You must enter a file to search for!" and clears the screen and starts over again. When I typed a term in to search for, xwindows. I got the following errors.
./findit: line 4: [: xwindows: unary operator expected
./findit: line 12: syntax error near unexpected token 'else'
./findit: line 12: 'else'
./findit: syntax error near unexpected token 'else'
./findit: line 12: else
If anyone can tell me how to arrange the lines or correct the syntax to get this working I'd really appreciate it.