2
I have the following function:
function ping {
nome=$(dialog --title "inform o endereço que deseja PINGAR" --inputbox "IP ou URL - \
Lembrando que será disparado 10 pings para o endereço informado." 10 45 --stdout)
status=$?
if [[ $status -eq 0 ]]; then
ping -c 10 $nome
rc=$?
if [[ $rc -eq 0 ]]; then
echo "#####################################"
echo "## Endereço: $nome | Status: UP"
echo "#####################################"
else
echo "#####################################"
echo "## Endereço: $nome | Status: DOWN"
echo "#####################################"
fi; else; echo "Você optou por cancelar a operação."; fi; } valor=`ping`; echo "RESULTADO FOI: "$valor
But when I run the script (./meuscript.sh
), I have no return, only if I select cancel in dialog.
If I run the script without the function, the command is executed correctly, showing me the correct 'Snippets'.
What am I doing wrong? Thank you for your attention!
Place the code instead of placing a code image. It makes it simple to answer your question.
– Omni
following your suggestion, done.
– Felipe FM