views:

26

answers:

1

My goal is to use a script that will install an executable file on Linux (Busybox variant). The target file should run when the computer starts, so in the rc.sysinit file, I'll have a line like the following:

/usr/bin/foo &

Now, when I run the install script, that line may or may not already be present (depending if the file had been installed previously). And it could be anywhere in the file. So how can I write the script so that line will be added to rc.sysinit only if it is not already there?

A: 

simply grep rc.sysinit for the filename:

if ! $(grep "/usr/bin/foo" rc.sysinit) 
then
  install_script
fi
ennuikiller
Oh that's easy! Thanks!
RB