Skip to content

Instantly share code, notes, and snippets.

@WaltHP
Created February 24, 2015 18:33
Show Gist options
  • Select an option

  • Save WaltHP/f48ab78222a93136a415 to your computer and use it in GitHub Desktop.

Select an option

Save WaltHP/f48ab78222a93136a415 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -f;
IFS='
'
`vagrant box list > boxes.txt`
box_list=`cat boxes.txt`
set +f; unset $IFS
#echo $box_list
for box in $box_list
do
echo "ass $box"
done
#select box in $box_list;
#do
# echo "You picked '$box' ($REPLY)"
# break
#done
#echo $box
#pick=$(echo $box | cut -f1 -d\ )
#pick=$(echo $box | awk '{print $1}' )
#entry_arr=($(echo ${box}))
#echo "you picked $pick"
# for whiptail sizing
lines=$(tput lines)
cols=$(tput cols)
menu_h=$((lines-3))
menu_w=$((cols-5))
menu_l=$((lines-11))
typedef -a ENTRIES
for box in $box_list;
do
name=$(echo $box | awk '{print $1}')
#ENTRIES="$ENTRIES \"$name\" \"$box\" OFF"
ENTRIES+=($name $box OFF)
done
echo $ENTRIES
exit
#echo "$menu_h $menu_w $menu_l"
cmd="whiptail --title \"Select Vagrant Box to use\" --radiolist \"Choose Vagrant BOX\" $menu_h $menu_w $menu_l $ENTRIES"
box=$($cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment