I need to process a file and immediately upload it somewhere. Consider the example and imagine we're doing aws s3 cp - s3://some-path/$FILE
instead of the dd
call:
from plumbum.cmd import split, seq, rev, dd
my_filter = (rev | dd['of=$FILE'])
cmd = seq['1', '10'] | split['--filter', str(my_filter)]
Given that $FILE is not passed directly but escaped, the subcommand in split
creates a file named $FILE
. How can I make it NOT escape the dollar expression, but take it verbatim?
As a temporary solution, I decided to monkey-patch
plumbum
'sshquote
:Putting this before the command execution solved the problem for me, but I would welcome another solution.