Quantcast
Browsing latest articles
Browse All 3 View Live

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 Article


Answer 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 Article


How 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
Browsing latest articles
Browse All 3 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>