I've a project with Vagrant. Sometimes I work from the Host. Some others I work from the Guest. I've a script that works only inside the Guest. I want to check if I am inside the vagrant machine, or outside, avoiding error messages. This is what I am doing:
if ! [ -d "/home/vagrant/project-folder" ]; then
echo 'Cannot execute current script outside the vagrant';
exit
fi;
There is another way to check if I am inside a vagrant machine than check if a folder exists?