linux - Bash, how to check for control character(non-printable character) in a variable? -



linux - Bash, how to check for control character(non-printable character) in a variable? -

i have bash statement user input(a single character) tmpchar :

read -n 1 -t 1 tmpchar

and can check printable character input this:

if [ "$tmpchar" = "n" ] || [ "$tmpchar" = "n" ]; # something... fi

now question is: if user input return, or esc, or ctrl+a, ctrl+b etc, how check them?

env: opensuse 12.3 , bash 4.2.42(1)-release

maybe you're looking ansi-c quoting. e.g., ctrl-a represented $'\ca'.

linux bash

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -