I'm currently trying to put the result of a bash command into a Cheetah variable :
#set $name = #echo '$input.element_identifier' + ".phy" | cut -d _ -f 1
'$input.element_identifier' Being (sort of) a link to the name of a previous input file (I try to do that in the section of a xml wrapper for Galaxy, a bioinformatics software)
My problem is that Cheetah does not recognize the '$' in the echo command ... I've tried a lot of other syntaxes but the problem remains the same (so I can't know if the rest of the command is correct)
This is a rather specific question (linked to the administration and use of the Galaxy software), I hope I'm clear.
Thanks
Two mistakes with your current approach:
#echodoesn't execute OS commands,#echoexecutes Python expressions.#echodoesn't return result,#echoputs the result into the output stream (HTML or whatever the output is).To execute an OS command you need
os.system()orsubprocess.Popen(). To assign the result of the command you certainly need to catch command's stdout,Popensuites the task better.Something like that: