|
From: | Chris F.A. Johnson |
Subject: | Re: basic pattern match Question..."newbie" doesn't understand (!@#$@$) |
Date: | Sun, 1 Aug 2010 23:11:28 -0400 (EDT) |
User-agent: | Alpine 2.00 (LMD 1167 2008-08-23) |
On Sun, 1 Aug 2010, Linda Walsh wrote:
I have: w="/home/law/bin/package: line 5: type: xx: not found" The =~ operator is suppose to use the RH Expr as a ext.-regex. So why doesn't this match and print "not found"? if [[ $w =~ ".*not found.*" ]]; then echo "not found"; fi It prints nothing. Seems like such a basic concept. Sorry, this newbie needs help on such trivial matters. :-(
When quoted, the right-hand argument is matched as a string, not an expression. -- Chris F.A. Johnson, <http://cfajohnson.com> Author: Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
[Prev in Thread] | Current Thread | [Next in Thread] |