grep in shell script fails on redhat 3.0
The issue seems to be for a particular environment,
as other linux boxes that I tested this script on worked just fine. this is the line in question: abc_string=`grep "abc_value ${string} " ${0}` $0 returns the script name as the file to search i.e: ./filename which returns "no such file or directory" the version of the grep is the same for all machines. I know this has to be some o/s level issue, but I don't see it in the env. o/s levels are 2.4.21.9.EL works / 2.4.21.20.EL fails Any thoughts ? |
The files name wouldn't contain a space by any chance?
Cheers, Tink |
Thanks for the thought, but no .... no space.
keep in mind it works fine on other linux systems. I thought it might be a literal translation in other words, it was looking for a file name './<somefile>' but no such luck. I am wondering if the grep command used in a script like this opens it's own thread "exec" , and that thread env is dong starting in $HOME or some such , thus the failure. looks like it may be time to try strace or truss. |
All I can say is that something like
Code:
#!/bin/bash and the {0} gave me the error-message you encounter ;) Cheers, Tink |
Just an FYI,
the problem was in the environment files that the script was sourcing when running. someone had placed a cd "change directory" so that when I sourced the environment for the shell script, it set PWD to $HOME instead of where the script was located. only took about 5 hours to figure it out. Oh well, sometimes you have to do the grunt work. thanks for your replies, they were sanity checks. |
All times are GMT -5. The time now is 07:17 PM. |