Skip to content

Instantly share code, notes, and snippets.

@joshenders
Last active October 3, 2015 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshenders/5a27f7808dbcdf13f491 to your computer and use it in GitHub Desktop.
Save joshenders/5a27f7808dbcdf13f491 to your computer and use it in GitHub Desktop.
$ 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