me ajuda problema no meu shell script

1

Eu preciso voltar de 2 ou 3 para 1 após o erro de impressão ??

 1      echo -e "program set defulte home dirctory /home/admin/$un"
        echo -e "DO you want use defulte home dirctory? Yes=1 & NO=2"
    read -a hd1
    case $hd1 in
            1)
             hd='/home/admin/$un' #40
             echo -e "your home dirctory $hd1 " ;;
            2)
             echo -e "Please insert name your home dirctory between 1 to 10 character:"
            read -a hda
            len1=${#hda}
            if [ "$len1" -eq "$ze" ];then
             echo "There is no Argument home dirctory" # error message
 2          exit
            fi
            if [ "$len1" -ge "$te" ];then #50
             echo "The argument home dirctory  maximum 10 alphanumeric" # error message
 3          exit     
            fi
            hd='/home/admin/$hda';;
            *) echo " You have selected wrong Choice!!!" ;;
    esac
    
por Beginners 31.10.2011 / 16:33

1 resposta

1

Use um loop while para manter a questão em execução e sair dela quando feito conforme mostrado abaixo

while :; do  # : evaluates to true, so "while true; do ...; done"
    echo "Choose A or B"
    read answer
    case "$answer" in
      [Aa]) # match case-insensitive A
        echo "A was chosen"
        break    # leave the while-loop
        ;;
      [Bb]) # match case-insensitive B
        echo "B was chosen"
        break    # leave the while-loop
        ;;
      *)
        echo "Please choose A or B only"
        ;;
    esac
done
    
por Lekensteyn 31.10.2011 / 17:14