Hi,
I have a really, what I hope is, simple question.
I'm looking for a simple way to see whether a file exists or not and then perform an action based on whether it exists or not. An example of what I tried is as follows:
if [ "ls /etc/init.d/ | grep mysql" = "mysql" ]
then {
echo "File mysql exists"
some_other_commands_might_go_here;
}
else {
echo "File mysql does not exist"
something_else_to_do_goes_here;
}
fi
Thing is, this doesn't work, so is it something to do with my syntax, or am I just being stupid? Or perhaps a bit of both?
Regards,
Paulo