C
Csaba Gabor
How can I do: echo messyExpression | myProg.exe -switches
when messyExpression needs quotes?
There are several posts that discuss stripping quotes, but those deal
with with the string already being a variable, and I am on the command
line. I want to call a program that only works interactively (that's
what the -a indicates below). Fortunately, I only need to pass it one
line of input so I can do this one liner from the Cmd Prompt on my Win
XP Pro system:
echo "<?php print('foo');exit(); ?>" | php.exe -a
Unfortunately, this prints:
"foo
instead of:
foo
Somehow, I would like to have echo not pass in those double quotes
cause that first one gets printed. I tried removing the double quotes
and instead escaped the < and >:
echo ^<?php print('foo');exit(); ?^> | php.exe -a
In this case I get the CMD prompt telling me:
The syntax of the command is incorrect.
and then php.exe does run, but it doesn't receive the input.
Similarly escaping all the other non word characters doesn't seem to
make a difference.
I hope someone will be able to set me straight.
Thanks,
Csaba Gabor from Vienna
when messyExpression needs quotes?
There are several posts that discuss stripping quotes, but those deal
with with the string already being a variable, and I am on the command
line. I want to call a program that only works interactively (that's
what the -a indicates below). Fortunately, I only need to pass it one
line of input so I can do this one liner from the Cmd Prompt on my Win
XP Pro system:
echo "<?php print('foo');exit(); ?>" | php.exe -a
Unfortunately, this prints:
"foo
instead of:
foo
Somehow, I would like to have echo not pass in those double quotes
cause that first one gets printed. I tried removing the double quotes
and instead escaped the < and >:
echo ^<?php print('foo');exit(); ?^> | php.exe -a
In this case I get the CMD prompt telling me:
The syntax of the command is incorrect.
and then php.exe does run, but it doesn't receive the input.
Similarly escaping all the other non word characters doesn't seem to
make a difference.
I hope someone will be able to set me straight.
Thanks,
Csaba Gabor from Vienna