Yes, that's much cleaner.
Run your menu like this:
Code:
while true; do
menu
case $? in
0) changelog ;;
2) download ; break ;; #or just exit, since it's the last command in the script
*) exit ;;
esac
done
This will re-run the menu until it hits "2", which breaks the loop, or any other non-zero number, which exits the script.
Since you know that the exit code will always be one of these numbers, there's no need to use any wildcards. I changed "1" to "*" though, just in case the yad command in the menu function could exit with another code (such as an error of some kind).
A couple of other suggestions:
Code:
sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/'
Kinda ugly. You can make it much more readable by using the -r option, and changing the delimiter to another character. You can also make it more efficient by targeting only the line you want. I think this will work...
Code:
sed -urn '\|eta| s|.*([0-9]+%).*([0-9]+[KMB]/s).*|\1\n# Downloading \2|p'
Awk may actually be better suited to this job, but I haven't tested it yet.
Code:
while [ $running -eq 0 ] ; do
When testing numeric conditions, it's advisable to use ((..)) instead.
Code:
while (( running == 0 )) ; do
http://mywiki.wooledge.org/ArithmeticExpression
Also consider using [[ when doing string comparisons or complex tests.
http://mywiki.wooledge.org/BashFAQ/031
And one more, that's more of question. Why are you using multiple commands that do about the same thing? wget and curl are similar, and yad is just a fork of zenity. Why not stick with just one or the other?
Edit: I see you figured it out yourself. Good job!
(No need to bother the mods; there's nothing wrong with your previous post.)