Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$ var=$(echo ' ab')
$ echo $var
ab
$ echo $var | xxd
0000000: 6162 0a ab.
$ if [[ "$var" =~ ^a ]]; then echo match; else echo not match; fi
not match
$ var=$(echo 'ab')
$ echo $var | xxd
0000000: 6162 0a ab.
$ if [[ "$var" =~ ^a ]]; then echo match; else echo not match; fi
match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment