Closed alanpearce closed 10 years ago
What version bash do you use ? What happen if you run:
if [[ `ls not_existing.txt` ]]; then
echo "OK"
else
echo "not OK"
fi
Please could you check as well:
if VBoxManage list vms | grep -wq "foo" ; then
echo "exist"
else
echo "not exist"
fi
bash-3.2$ bash --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)
Copyright (C) 2007 Free Software Foundation, Inc.
bash-3.2$ if [[ `ls not_existing.txt` ]]; then
> echo "OK"
> else
> echo "not OK"
> fi
ls: not_existing.txt: No such file or directory
not OK
bash-3.2$ if VBoxManage list vms | grep -wq "foo" ; then
> echo "exist"
> else
> echo "not exist"
> fi
not exist
All seems fine.
But what happen if you run this ?
if [[ `VBoxManage list vms | grep -w "foo"` ]]; then
echo "exist"
else
echo "not exist"
fi
bash-3.2$ if [[ `VBoxManage list vms | grep -w "foo"` ]]; then
> echo "exist"
> else
> echo "not exist"
> fi
not exist
Now I'm confused.
On OSX, calling
vbkick buildvm foo
fails with "foo already exist", for any value of foo. I couldn't work out why this is, asVBoxManage list vms | grep -w "foo"
returns 1.