kkimurak / ssl-setup

Bash script that setup the official RoboCup-SSL tools with required packages ( https://github.com/RoboCup-SSL/ )
4 stars 0 forks source link

unexpected behavior with timeout of `read -t` #15

Closed kkimurak closed 5 years ago

kkimurak commented 5 years ago

I'm currently using read with option -t to set the path to place ssl-tools,
but read -t will make the script finish when nothing typed.
In my idea, It must jump to the * ) case if there is no input.

To check exit status code will help us to solve this problem.

Current code :

read -r -t 60 SSL_DIR
# process finish before reaching to `case`
case $SSL_DIR in
    # each process

Example code to check the exit status :

read -r -t 60 SSL_DIR || if [ "$?" == "142" ] ; then echo " set to default..."; fi
case $SSL_DIR in
    # each process

It worked fine.