问题
I'm reformulating a bit better my previous question from today.
So basically, I have a bash script where i have
variable=$(zenity list dialog)
if test $variable = "something i've checked in zenity"
then
run command & restart the script
elif...
...another command, etc...
fi
Where I have "restart the script", before a simple exec $0 was enough as a workaround, but I had to change the script and it's no longer working.
Now because I was doing a weird workaround anyway where I was spamming the system with processes, and stuff was erroring out in the script due to this, I want to do it nicely.
I need the script to go back to refresh the $variable, so to re-call zenity and to re-execute the if/elif loops again.
Basically a simple goto-like statement, but within the if/elif statements, not at the end of the script (because some programs that I execute can hang).
From what I understand, something like case needs to be used instead?
来源:https://stackoverflow.com/questions/66003835/re-asking-for-a-variable-after-execution-in-bash-like-an-alternative-to-goto