I'm creating a simple script
for learning in which the user should:
- Type number to be saved in variable NUM1
- Enter a second number that will be saved in variable NUM2
- Choose from the menu if it wants to add, subtract, multiply or divide these numbers.
After these procedures, it should appear in the terminal "The option chosen was: sum (such as if it had chosen subtraction, subtraction would appear there [without accent because it is the variable that I want to appear]
Code I created:
#!/bin/bash
clear
NUM1=$( gdialog --inputbox "Informe o número 1"
gdialog --title 'Aviso' )
NUM2=$( gdialog --inputbox "Informe o número 2"
gdialog --title 'Aviso')
escolha=$( gdialog \
--menu 'Escolha:' \
0 0 0 \
soma '+' \
subtracao '-' \
multiplicacao '*' \
divisao '/' )
echo "A opção escolhida foi: $escolha"
exit
Problem: When I run, I do all the procedures as user until the choice in the menu, appears in the terminal what was chosen, however, is not what I asked to appear and immediately below "The option chosen was:" and does not appear variable on the front.
I would like this variable to appear to see that it is actually being saved in $ choice, so I can find a way to use the switch case and finish my script.
NOTE: I use gdialog for visual mode.