Command line special characters peculiarity.
I have a friendly little php program (Myprog.php) which takes two
arguments (a pattern and a string) like so in DOS within Windows 98:
php.exe -q Myprog.php -p "pattern" -s "mystring"
OK, so it's really 4 arguments. The -q is to shut up php, but the -p and -s are for Myprog.php so that it knows that pattern and mystring are following.
If pattern and mystring are dull, run of the mill strings, then the quotes are not necessary.
But special characters rear their ugly heads and life gets more interesting.
To have a double quote passed in, prefix it with a backslash ().
If there is a space in the string better surround the string with double quotes.
Can anyone tell me where this behaviour is documented?
In particular, I cannot for the life of me seem to pass in a plus (+) character.
If I try
php.exe -q Myprog.php -p "[.\n]+more is better" -s "Hi\"There"
I wind up with the following lengths and values in $argv:
10 Myprog.php
2 -p
5 [.\n]
14 more is better
2 -s
8 Hi"There
Notice how pattern got split into two pieces (and the quotes got swallowed without complaint. How do I supress this behaviour (prefixing with a backslash does not work). Also, what other screwy characters are there, and is this a DOS thing or a PHP thing? Finally, as a general question, is there a DOS mechanism for getting around the 127 character line limitation (perhaps by reading arguments indirectly from a file?)?
Thanks for any pointers,
Csaba Gabor