Michael Halcrow wrote:

On Tue, Jun 17, 2003 at 02:43:41PM -0700, Bryan Murdock wrote:

I'm looking at some shell scripts a co-worker wrote and there is a line
that looks like this:

esc=`echo "$arg" | sed "s/'/'\\\\\\\\''/g"`

I can't figure out why any regular expression would need that many
backslashes.  Can any of you?


Hmmm... perhaps it is a self-referential script? :-P

Mike



Yeah, or a self-self-referential script. It'll be 3 more iterations before that single quote at the end gets un-escaped again. Maybe it's using that string to form some SQL insert statement, which might be retrieved later into some other kind of script which outputs some dynamic javascript or something. Whoa I'm getting dizzy.



____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to