Im making a tool script for my theme has 6 options: 1) Check theme update 2) Reinstall theme 3) Install font 4) Install wallpaper 5) Check tool update 6) Quit
Here is the code
clear
echo "==========================="
echo "Tool for theme"
echo "==========================="
function check_update {
echo "checking theme update"
}
function reinstall_theme {
echo "Reinstalling"
echo "==========================="
}
function font {
echo "Installing font"
}
function wall {
echo "Installing wallpaper"
}
function check_update_tool {
echo "Checking tool update"
}
all_done=0
while (( !all_done )); do
options=("Check theme update" "Reinstall theme" "Install font" "Install wallpaper" "Check tool update" "Quit")
echo "Choose an option: "
select opt in "${options[@]}"; do
case $REPLY in
1) check_update; break ;;
2) reinstall_theme; break ;;
3) font; break ;;
4) wall; break ;;
5) check_update_tool; break ;;
6) all_done=1; break ;;
*) echo "Invalid option" ;;
esac
done
done
echo "Exiting"
sleep 2
But when I run it, the selections of menu mess up
==================
Tool for theme
==================
Choose an option:
1) Check theme update 2) Reinstall theme 3) Install font
4) Install Wallpaper 5) Check tool update 6) Quit
But what I want is
===============
Tool for theme
===============
Choose an option:
1) Check theme update
2) Reinstall theme
3) Install font
4) Install wallpaper
5) Check tool update
6) Quit
So how can I fix the menu?
foo.sh
) on my system already produces your expected output if run with a dot. foo.sh
, but produces the messed up output if run without itfoo.sh
.