Like most makefiles, I have some bash scripts that use variables for executables. For example, $mysql_exec
for /usr/bin/mysql. I would like to be able to say something like:
mysql_exec=mysql
to use $PATH or
mysql_exec=/usr/bin/mysql
to get an absolute location without $PATH. I also want to check to see if the executable is valid using something like this:
if [ ! -x $mysql_exec ] ...
However, this command:
if [ ! -x "mysql" ]; then print "oh oh"; fi
Actually prints "oh oh", even though mysql is in my $PATH. From the command-line, typing mysql
has the same effect as typing /usr/bin/mysql
. So, how do I get bash really check to see if $mysql_exec is an executable ($PATH and all)?