Skip to content

Commit d25f81b

Browse files
committed
fix setup file
1 parent 7cf3542 commit d25f81b

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

setup

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,24 @@ read userid
2222
printf "Bot Token: "
2323
read_secret token
2424

25+
26+
get_input(){
27+
while true; do
28+
printf "Is this information correct (y/n)? "
29+
read yn
30+
case $yn in
31+
[Yy]* ) return 1;;
32+
[Nn]* ) return 0;;
33+
* ) echo "Incorrect option (y/n)? "; echo;
34+
esac
35+
done
36+
}
37+
2538
#confirm before ending
26-
while true; do
27-
printf "Is this information correct (y/n)? "
28-
read yn
29-
case $yn in
30-
[Yy]* ) saveinfo "$userid" "$token"; git checkout main; . ./sync break;;
31-
[Nn]* ) break;;
32-
* ) echo "Please answer yes or no."; echo;;
33-
esac
34-
done
39+
get_input
40+
if [[ $? == 1 ]];
41+
then
42+
saveinfo "$userid" "$token"; git checkout main; . ./sync
43+
else
44+
exit
45+
fi

0 commit comments

Comments
 (0)