Executing generated commands in bash

I want to run a series of bash commands generated by a Python script. The commands are of the form export foo="bar" and alias foo=bar. They must modify the environment of the current process.

This works great:


until an export command contains a space e.g. export x="a b". This generates an error, and only "a is exported (quotes included).

Currently I'm working around this by outputting generate_commands to a temporary file and sourcing that, but is there a more elegant solution?


./generate_commands | bash

This will pipe the output of the script as input to bash


To allow for variables to be visible in the current shell, you need to source the output:

source <(./generate_commands)


. <(./generate_commands)

Need Your Help

Is this possible to create video from pdf file?

php pdf video ffmpeg

I want to make video from pdf file.Is it possible?