Robin Becker <ro***@SPAMREMOVEjessikat.fsnet.co.uk> writes:
Is it possible to use python with a shell HERE document as the script
and read the standard input? In other words make python usable as a
filter with a side input?
It doesn't seem to be obvous unless I can somehow use the -c option.
--
Robin Becker
python -c "`cat <<OOK
from sys import stdin
for line in stdin:
print line.upper(),
print 'ha ha', "ho ho"
OOK
`"
ie the value of -c can be a complete program as long as you keep the newlines
intact and don't mess up the quotes. However it would probably be a lot
simpler to copy the script to a temp file and execute that (ignoring
pathological security issues).
(Only tested with bash!)
Eddie