bash 쉘 while문 질문입니다

조회수 376회

자꾸 done 부분에서 에러가 나요 while문 2개 done 2개 제대로 있는데 뭐가 문제인지 코드도 길어서 한번에 보이지도 않는데 그와중에 vmware로 작업해서 창도 작고 열받아 죽겠습니다

selectsignin() {

    while :
    do
        read -s -N1 input
        if [  "$input" = ""  ]
        then
        read -s -n 1 input
        if [  "$input" = "["  ]
        then
        read -s -n 1 input 
        if [  "$input" = "B"  ] && [  $statesn == 1  ]
            then
            pw
        elif [  "$input" = "C"  ] && [  $statesn == 1  ]
            then
            dc
        elif [  "$input" = "A"  ] && [  $statesn == 2  ]
            then
            id
        elif [  "$input" = "B"  ] && [  $statesn == 2  ]
            then
            sn
        elif [  "$input" = "B"  ] && [  $statesn == 3  ]
            then
            ex
        elif [  "$input" = "D"  ] && [  $statesn == 3  ]
            then
            id
        elif [  "$input" = "A"  ] && [  $statesn == 4  ]
            then
            pw
        elif [  "$input" = "C"  ] && [  $statesn == 4  ]
            then
            ex
        elif [  "$input" = "A"  ] && [  $statesn == 5  ]
            then
            dc
        elif [  "$input" = "D"  ] && [  $statesn == 5  ]
            then
            sn
        fi
        fi
        elif [  "$input" = "$enter"  ] && [  $statesn == "5"  ]
            then
            exit
        elif [  "$input" = "$enter"  ] && [  $statesn == "1"  ]
        then 
            echo -e "\033[6A"
            echo -n "      "
            echo -n  "               " 
            echo -n "   "
            echo  " Duplicate check " 
            echo ""
            echo -n "      "
            echo -n  "               "  
            echo ""
            echo ""
            echo -n "          "
            echo -n  " SIGN IN " 
            echo -n "    "
            echo -n  "  EXIT  "
            echo ""
        if [  ! -e "userid1.txt"  ]#7
            then
            touch userid1.txt
            echo -e "\033[6A"
            echo -n "      "
            echo -n 
            echo -n "    "
            read userid
            echo -n 
            echo -n -e "\033[0B"
            echo -n "      "
            echo -n 
            echo -n "    "
            read userpw
            echo -e -n "\033[1B"
            echo -n  "         "
            echo -n  " SIGN IN " 
            read -s -N1 input
        if [  "$input" = "$enter"  ]#6
            then
            userid > userid1.txt
            userpw >> userid1.txt
            exit
        fi#6
        else
            touch userid2.txt
            echo -e "\033[6A"
            echo -n -e "\033[10C"
            echo -n 
            read userid
            echo -n 
            echo -e -n "\033[1A"
            echo -n -e "\033[26C"
            echo  " Duplicate check " 
            read -s -N1 input
        if [  "$input" = "$enter"  ]
            then
        while read line
        do
        if [  "$line" = "userid"  ]
            then    
            echo -e -n "\033[6B"
            echo "sign in OK"
            exit
        else
            echo -e -n "\033[6B"
            echo "sign in X"
            exit
        fi
        done < userid1.txt
        elif [  "$input" = ""  ]
            then
            read -s -n 1 input
            if [  "$input" = "["  ]#4
                then
                read -s -n 1 input
            if [  "$input" = "D"  ]#3
                then
                echo ""
                echo -n "      "
                echo -n  "               "
                echo -n -e "\033[11D"
                read userpw
                echo -n 
                echo -n -e "\033[1B"
                echo -n "         "
                echo  " SIGN IN "
                read -s -N1 input
            if [  "$input" = "$enter"  ]
                then
                touch userid2.txt
                userid > userid2.txt
                userpw >> userid2.txt
                exit
            fi
            fi
            fi
        fi
        fi
        fi  
    done
}

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)