[mod] use 'awk' instead of 'cut' to split line.

This commit is contained in:
Moul 2016-10-12 11:51:41 +02:00
parent 20fd7daa7e
commit d8a5e5ec53

View file

@ -151,9 +151,9 @@ elif [ "$1" = "run" ]; then
##################### #####################
elif [ "$1" = "halt" ]; then elif [ "$1" = "halt" ]; then
vm=$(vagrant global-status | head -3 | tail -1) vm=$(vagrant global-status | head -3 | tail -1)
vm_status=$(echo $vm | cut -d ' ' -f 4) vm_status=$(echo $vm | awk -F '[[:space:]]' '{print $4}')
if [ $vm_status == "running" ]; then if [ $vm_status == "running" ]; then
vm_id=$(echo $vm | cut -d ' ' -f 1) vm_id=$(echo $vm | awk -F '[[:space:]]' '{print $1}')
vagrant halt $vm_id vagrant halt $vm_id
echo "> VM turned off." echo "> VM turned off."
else else