I have this bash script I would like to pause so I can read what is echoed. I use this on a mobile phone so the screen is very small. The continent output is in 2 colums by default, can I do this with the city output aswell
I tried putting " | more " before && but it didn't work.
normaly I put everything in functions() but finding the select command here on stackoverflow.com made it much faster.
#!/bin/bash
PS3=" Enter a Number "
dir=/usr/share/zoneinfo
echo
echo " Please select your Continent "
echo
select continent in $dir/* ; do
test -n "$continent" && break;
echo ">>> Invalid Selection";
done
selected_cont=($(echo "$continent" | grep -Eo '[^/]+/?$' | cut -d'/' -f2 ))
echo
echo " Selected $selected_cont as your Continent "
echo
echo " Please select nearest city "
select city in $continent/* ; do
test -n "$city" && break;
echo ">>> Invalid Selection";
done
echo
selected_city=($(echo "$city" | grep -Eo '[^/]+/?$' | cut -d'/' -f2 ))
timezone="$selected_cont/$selected_city"
echo
echo
echo " $timezone is selected as your timezone "
#echo "show Continent: $continent"
#echo "show City: $city"
sleep 2
#echo export TZ=$city >> $HOME/.bashrc
#sudo ln -sf $city /etc/localtime
This was my first working try
This is my second try with directory and file check
This 2nd one is preferred but it errors on line 6 continent= Error: Expected a box option. The script continuous as wanted and the result is as wanted.
Can anyone clarify the error as I use the same variable in script one without errors?
I've updated to output to a temp file no errors in this script