I'm trying to determine if a given Virtual Machine is running using a shell script.
The command "virsh list | grep MediaWiki", when run manually, returns one line if the Virtual Machine is running, and returns nothing when it's not.
I'm trying to use:
if [`virsh list | grep MediaWiki` !== ""]
then
echo "The MediaWiki VM is Running!"
else
echo "Not Running!"
fi
But I don't think I've got the syntax quite right. With the above code, it claims the machine is running whether it is or not.