Posted by tendiamonds on 2007-01-10 14:27:02 +0000
I feel like I'm being mocked...
Stupid Perl.
Posted by tgl on 2007-01-10 15:33:31 +0000
Guess what I'm futzing with today? BTW, why doesn't this work:
$return_value=`psql -h localhost -U postgres -q -c "\l"`;
$return_value is null, the thing inside the ticks works great on the command line.
Posted by tgl on 2007-01-10 16:11:06 +0000
Must be something with the quotes. I can get the same information (table listing) with this command `psql -h localhost -U postgres -q -l`.
Just in case anyone was wondering...
Posted by tendiamonds on 2007-01-10 16:13:44 +0000
Try doubling your slash.
Non-geeks, please stop reading.
Recently, I was grepping the source here at The Company, to see if anyone has a regular expression that escapes special regular expression characters. So any char that is special will have a backslash (heretofore refeered to as a slash) inserted before it.
To replace a slash before a match in a regular expression, you need a pattern that looks like "\\$0" or "\\$1' or "\\$&". (note that the slash itself needs to be escaped to be literal) So I'm grepping the source for a pattern that looks like "\\$", being the common bit of text.
Now, the fun stuff.
Since I'm looking for regular expressions in C++ code, the slashes themselves need to be escaped, as the C++ compiler interprets string literals in souce code. So the pattern "\\$" has to be "\\\\$" in C++ source.
Now, remember that I'm using a regular expression (grep) to search for this stuff, so all of those slashes need to be escaped, as does the $... So I need to grep using "\\\\\\\\\$"
But I'm not done. I'm running this grep from some csh derivative, which also interprets string literals, so slashes need to be escaped again. So I have to grep using "\\\\\\\\\\\\\\\\\\$" in order to find this pattern. That's 18 slashes. Perfect.
Posted by tgl on 2007-01-10 16:23:54 +0000
Escape the slash is right, thanks.
While I'm on a roll: "!~" should return true if _no_ match is found?
Posted by tendiamonds on 2007-01-10 16:32:14 +0000
That sounds reasonable, I'm not necessarily familiar with your scripting language.
Posted by tgl on 2007-01-10 16:32:31 +0000
Yes. I should get a job as a sys. admin or something.
Speaking of which: Just got the "to everyone" email from our IT department that non-IT issued hardware should not connect to our network via VPN. Which is lame.