wilas / vbkick

Tool for building and maintaining VirtualBox VMs described as a code in a single definition file.
Other
8 stars 5 forks source link

Incorrectly detects duplicate VMs #4

Closed alanpearce closed 10 years ago

alanpearce commented 10 years ago

On OSX, calling vbkick buildvm foo fails with "foo already exist", for any value of foo. I couldn't work out why this is, as VBoxManage list vms | grep -w "foo" returns 1.

wilas commented 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
alanpearce commented 10 years ago
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.

wilas commented 10 years ago

But what happen if you run this ?

if [[ `VBoxManage list vms | grep -w "foo"` ]]; then
    echo "exist"
else
    echo "not exist"
fi
alanpearce commented 10 years ago
bash-3.2$ if [[ `VBoxManage list vms | grep -w "foo"` ]]; then
>     echo "exist"
> else
>     echo "not exist"
> fi
not exist

Now I'm confused.