Click to See Complete Forum and Search --> : line 10: grep: command not found ?
JesterDev
05-14-2004, 05:31 PM
I'm learning shell scripting again, and I wrote a simple script:
#! /bin/bash
for file in *
do
if grep -q POSIX $file
then
echo $file
fi
done
exit 0
And when I run it I get this error:
./first: line 10: grep: command not found
Any ideas as what is going on here?
Running Suse Linux 9.1
JohnT
05-14-2004, 05:48 PM
Runs fine here.:confused:
JesterDev
05-14-2004, 07:26 PM
Well I don't know what happened, but I closed eterm down and opened it again and now it works... The book I'm reading suggested I do: PATH=$PATH:. and then a few paragraphs down said that it may not be such a good idea to do that for security reasons especially as root which I was not. (Good idea putting that down a ways after suggesting it!) So anyway, I seems to have only been a temporary thing if that was what caused the problem. ???
bwkaz
05-15-2004, 10:42 AM
BTW, if those extra blank lines before the #! are in your script, get rid of them. The two characters #! must be the first two characters in the script for it to be properly recognized as a script by all Unix-like kernels...
Anyway, it's possible that you mistyped something with that PATH resetting (maybe you missed the shift key on one of the letters?), so you ended up just setting PATH to :. -- and that will only ever search the current directory.