Code using GREP only works after login. Needs to work on boot up??
i've had this problem with grep for a few days. i just dont understand whats going on. When i run this code automatically at boot up it only half works. where as if i run it after boot it runs perfectly fine.
the code is supposed to retrieve an item from the KERNEL line.
my expected/desired result is hdl.
manual means i typed /etc/rc.local to invoke the code after login.
any ideas at all?
Thanks in advance,
it seems to be the regular expression part of the Grep statement that is throwing it out.
the '[a-Z]*' is the bit that fails when the script is run during boot up.
i have a symbolic link to the script at S99 in rcS.d. so it gets run just before rc.local (pretty much).
perhaps the libraries or something for reg-ex have not been loaded at this point???
are your sure, that at boot time the following prerequisites are defined?
1. Is your /bin/sh really the bash or is it a simple Bourne shell at boot time (you are using bash specific syntax)?
2. Is the egrep path defined in the PATH environment variable?
I'm not sure that the commands you use are really available. Try this:
1. Do a /bin/ls -l /bin/sh
2. Do a type egrep
within your script. Normally the path to egrep (on my system /usr/bin/egrep) is not defined for rc scripts.
Most of the time your $PATH won't include /usr/bin during initialization. Logging in corrects this. Try using /usr/bin/egrep.
|All times are GMT -5. The time now is 03:15 AM.|