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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -