Skip to content

Instantly share code, notes, and snippets.

@zackdouglas
Created November 18, 2011 00:02
Show Gist options
  • Save zackdouglas/1375040 to your computer and use it in GitHub Desktop.
Save zackdouglas/1375040 to your computer and use it in GitHub Desktop.
BASH variable regexp
#!/usr/bin/bash
FOO='the scarecow walks at midnight'
if [ 'the scarecrow walks at midnight' = ${FOO/scarecow/scarecrow/} ] ; then
echo 'your shell supports regex on variable retrieval'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment