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.
Q. Why "142" ?
A. I've tested on Ubuntu 18.04 LTS, Fedora29 and Arch Linux.
Timeout for read -t N always returns it (of course N is not 0).
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 :
Example code to check the exit status :
It worked fine.
Timeout for
read -t N
always returns it (of course N is not 0).