Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- foo=baaz
- regex='ba{2}z'
- if [[ $foo =~ 'ba{2}z' ]]; then
- echo "literal worked"
- fi
- if [[ $foo =~ $regex ]]; then
- echo "variable worked"
- fi
- #! /bin/bash
- foo=baaz
- regex='ba{2}z'
- if [[ $foo =~ ba{2}z ]]; then
- echo "literal worked"
- fi
- if [[ $foo =~ $regex ]]; then
- echo "variable worked"
- fi
- # Should output literal worked, then variable worked
Add Comment
Please, Sign In to add comment