How do I get a Bash Shell Enter?

Asked 2 years ago, Updated 2 years ago, 69 views

I want to end the program when I receive the enter with the read command I looked it up on the internet, and they got an entry with "." But I keep getting errors when I try it Can you tell me what the problem is?

while :
 96     do
 97         read -s -n 1 input
 98         if [  $input == "^["  ]
 99         then
100         read -s -n 1 input
101         if [  $input == "["  ]
102         then
103         read -s -n 1 input
104         if [  $input == "B"  ] && [  $state == 1  ]
105             then
106             btexit
107         elif [  $input == "C"  ] && [  $state == 1  ]
108             then
109             signin
110         elif [  $input == "D"  ] && [  $state == 2  ]
111             then
112             join
113         elif [  $input == "B"  ] && [  $state == 2  ]
114             then
115             signout
116         elif [  $input == "A"  ] && [  $state == 3  ]
117             then
118             join
119         elif [  $input == "C"  ] && [  $state == 3  ]
120             then
121             signout
122         elif [  $input == "A"  ] && [  $state == 4  ]
123             then
124             signin
125         elif [  $input == "D"  ] && [  $state == 4  ]
126             then
127             btexit
128         fi
129         fi
130         elif [  $input == ""  ]
131             then
132             exit
133 
134         fi
135     done
136 }

bash shell

2022-09-20 10:29

1 Answers

elif [[  $input = ""  ]]

Thank you.


2022-09-20 10:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.