Reputation: 59
I'm trying to figure out how to do a repeating question and what I have is imposing some issues I believe regarding the function brackets.
options.sh: 8: options.sh: Syntax error: "do" unexpected (expecting "}")
Here is the sample
#!/bin/bash
# v0.1 b1 3/30/2016
# REPEATING FUNCTIONS
ramdisk_memory() {
echo -e "\nRAMDISK SETTINGS\n"
echo -e "Enter the size of the RAMDISK in megabytes:"
read ramsize
echo -e "You selected a size of ${ramsize} megabytes. Is this correct?"
select yn in "Yes" "No"; do
case $yn in
Yes ) setup_ramdisk ramsize; break;;
No ) ramdisk_memory; break;;
esac
done
}
setup_ramdisk() {
echo "You did it!"
}
Upvotes: 1
Views: 2706
Reputation: 15461
If you call your script with sh options.sh
, the bash shebang will be overriden with a call to /bin/sh
that does not support select
. You can either call your script with :
bash options.sh
chmod u+x options.sh
and invoke it with ./options.sh
Upvotes: 3