Executing generated commands in bash -
i want run series of bash commands generated python script. commands of form export foo="bar" , alias foo=bar. must modify environment of current process.
this works great:
$(./generate_commands.py) until export command contains space e.g. export x="a b". generates error, , "a exported (quotes included).
currently i'm working around outputting generate_commands temporary file , sourcing that, there more elegant solution?
./generate_commands | bash this pipe output of script input bash
edit:
to allow variables visible in current shell, need source output:
source <(./generate_commands) or
. <(./generate_commands)
Comments
Post a Comment