I am trying to use the bash operator selectfor a command loop. The variable in the select clause is always empty. Here is a simple script that illustrates the problem:
#!/bin/bash
select term in one two exit
do
echo you selected $term
case $term in
one ) echo one; break;;
two ) echo two; break;;
exit ) echo will exit; return;;
esac
done
Here is what happens when I run this script:
$ ./test.sh
1) one
2) two
3) exit
you selected
you selected
you selected
Does anyone know what I can do wrong? I am on Mac OS X 10.7.3. /bin/bash --versionshows: GNU bash, version 3.2.48 (1) -release (x86_64-apple-darwin11)
source
share