Is it okay for me to check the contents of a file for a given string with grep
in an init
script?
I am concerned about introducing dependencies and general convention when it comes init
scripts, and if running grep
or other tools violates some credo.
iniscripts can do whatever they want. Of course it makes sense not to introduce new dependencies, just for the initscripts. grep however is fine on pretty much any system that's posix/susv3 compatible (linux, bsd, solaris, other derivatives).
For more utilities that should always be there, see http://pubs.opengroup.org/onlinepubs/009695399/idx/utilities.html
In short, YES. So long as the file you are looking for is mounted at that point.