
FIx3r
(usa Ubuntu)
Enviado em 17/02/2010 - 10:15h
Um amigo aqui da comunidade, Smithux, me ajudou com essa dúvida e consegui entender. Sou iniciante em shell script e to ralando pra aprender um pouco. Muito obrigado pela ajuda ae pessoal.
abraço.
----------------------
Smithux
E aí amigão!!!
Segue o script que você me pediu ajuda! :D
#################################
#!/bin/bash
temp_file="/tmp/opcao.tmp"
function Principal(){
rm -rf $temp_file
dialog --yesno 'Gostaria de Prosseguir?' 0 0
if [ $? -eq 0 ]; then
dialog --title 'Digite Seu Nome:' --inputbox '\n Nome:' 0 0
dialog --title 'Aguarde' --infobox '\n ...' 0 0
fi
}
function Secundaria(){
rm -rf $temp_file
dialog --yesno 'Deseja executar a segunda função?' 0 0
if [ $? == 0 ]; then
dialog --title '2ª Função!!!' --infobox 'Teste!!!' 0 0
fi
}
dialog --title 'Funções:' --menu 'Escolha uma das funções para executar:' 0 0 0 '1' 'Principal' '2' 'Secundaria' 2> $temp_file
opcao=$(cat $temp_file | tail -n 1)
if [ $opcao -eq 1 ]; then
Principal
elif [ $opcao -eq 2 ]; then
Secundaria
else
echo "Opção inválida!"
fi
#################################