So I want to make a script that runs a command if a drive is mounted, if not it should run a different command. I found this:
#!/bin/sh mounted=`df | grep "/mountpoint"` if [[ mounted != "" ]] ; then command_1 else command_2 fi
But it only runs the first command if that drive is mounted, if it isn’t then it complains that the file or drive does not exist. It doesn’t try to run the second command.
Any help is appreciated.