↧
Answer by chepner for How to catch carriage return / line feed in case statement
Since read only reads a single line of input, sans newline, you just want to check for the empty string: read Option case $Option in 1 ) echo "1" ;; 2 ) echo "2" ;; "" ) echo "LF" ;; 0 ) exit ;; * )...
View ArticleAnswer by PSkocik for How to catch carriage return / line feed in case statement
read will strip it. The case statement itself works. #read Option Option=' ' case "$Option" in [1] ) echo "1" ;; [2] ) echo "2" ;; [$'\n'] ) echo "LF" ;; [0] ) exit ;; * ) echo "Invalid input" ;; esac...
View ArticleHow to catch carriage return / line feed in case statement
I tried the following to no avail and couldn't find any documentation. read Option case $Option in [1] ) echo "1" ;; [2] ) echo "2" ;; [$'\n'] ) echo "LF" ;; [0] ) exit ;; * ) echo "Invalid input" ;;...
View Article