In the xonsh
shell how can I pipe the output of a Python construct to another command? Desired example:
for v in ${...}: print ("{}={}".format(v,${v})) | head
In this for v in ...
is the Python construct and head
is the command I want to pipe its output through.
The command line above does not work; I get always the following error:
NameError: name 'head' is not defined
Looks like xonsh
doesn't leave the Python-mode for the pipe symbol (see "Pipes" in the xonsh docs). - So, how can I instruct xonsh
to understand the pipe character here as a subprocess-mode symbol?