Paul Jarc spake thusly on 07/11/2007 12:10 PM:
Scott Carpenter <[EMAIL PROTECTED]> wrote:
V="one/two"
[[ ! $V =~ ^\.*/ ]] && echo not
3.1 will remove the backslash as part of basic string parsing, just as
if this were not part of a [[ command, while 3.2 handles the arguments
for [[ specially, and will keep the backslash as part of the regexp.
This will work in both versions:
pattern='^\.*/'
[[ ! $V =~ $pattern ]] && echo not
paul
Thanks, Paul (and Chet for also responding).
I had seen hints about using a variable but when I tried before posting
my question I must have used double quotes or no quotes, which didn't
work. I tried with single quotes now and works fine, along with
parentheses to get BASH_REMATCH: '(^\.*/)'
I really appreciate your guys's patience in answering this newbs
question, especially for something that must be an Extreme FAQ by now
with the version change. Keep up the great work -- as an escapee from
the Windows prison camp, I'm enjoying using and learning more about bash.
Scott
_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash