Grep is missing the command -A ?
I wrote a script that has this in the file
grep -A 1 'Release' earning.* but when I ported it to another machine running centOS, it gave me ./earnings.sh: line 10: -A: command not found How come -A is available on one machine, but not the other? More importantly, how do we fix this? |
When I ported over to the new machine, it did not have the grep command. therefore the machine was reading
-A 1 'Release' earning.* instead of grep -A 1 'Release' earning.* doh! |
This whole thing sounds strange. First of all, grep is a basic, low-level, posix-defined tool that start-up scripts often depend on, and should always be installed as part of the core system.
Second, it seems odd that it would error on the -A. Just because the command doesn't exist doesn't mean that the command word would be ignored. It should be saying something like "grep: command not found" instead. BTW, you should also be aware that while Linux distros generally use the gnu versions of the basic system toolset, other unixes have their own implementations of them, and these often have different, and sometimes more limited, command options. You have to be quite careful when porting scripts between different types of systems. |
All times are GMT -5. The time now is 10:59 AM. |