I want to create bash shell script which can - find string in file - then delete word - then restart service
I have tried this code
Restart.sh
#!/bin/sh
grep -q 'RestartServiceApache' /srv/www/config_apa
if [ $result -eq 1 ];
then
sed '/RestartServiceApache/d' "/srv/www/config_apa"
/etc/init.d/httpd reload
fi
and my config_apa
Hello my name is nutnud.
#RestartServiceApache
This is all just a test file.
and the Error is
./Restart.sh: line 3: [: -eq: unary operator expected
I tried a lot of script and it doesn't work there is always an error like cannot grep or something