Hi,
is there a tool, that parses and exports the variables defined in the `houdini.env` file into a shell? (To bash in my case.)
Thanks,
Mate
Importing `houdini.env` into the shell
2395 4 0- gadfly16
- Member
- 65 posts
- Joined: May 2009
- Offline
- jsmack
- Member
- 7803 posts
- Joined: Sept. 2011
- Offline
- gadfly16
- Member
- 65 posts
- Joined: May 2009
- Offline
Thanks for the insightful answer!
Unfortunately by “export” I mean exporting not printing: Exporting Variables [bash.cyberciti.biz] .
To be more exact I would like to have a bash shell where the environment variables defined in `houdini.env` are set. In my understanding this is only achievable by setting these variables and start a sub-shell, since a sub-process can not export to its parent. But those who know the answer will aware of this detail..
I hope this further clarifies my question.
Thanks again,
Mate
Unfortunately by “export” I mean exporting not printing: Exporting Variables [bash.cyberciti.biz] .
To be more exact I would like to have a bash shell where the environment variables defined in `houdini.env` are set. In my understanding this is only achievable by setting these variables and start a sub-shell, since a sub-process can not export to its parent. But those who know the answer will aware of this detail..
I hope this further clarifies my question.
Thanks again,
Mate
Edited by gadfly16 - Aug. 12, 2020 03:53:50
- KaiStavginski
- Staff
- 639 posts
- Joined: Aug. 2013
- Offline
You can set variables from a bash script if you just source it. But the houdini.env file doesn't exactly contain shell commands.
In bash you could do something like this:
grep -v “#” just filters out comment lines
grep “=” filters for lines actually containing an assigment
xargs -L1 echo export just prints each line with “export” prepended.
So you get output like
export HOUDINI_NO_SPLASH=1
Wrapping the whole command in $() will execute the whole thing as a shell command.
Bash also requires that there's no space around the =. Just make sure of that in your file, I didn't take care of that in the one-liner.
In bash you could do something like this:
$(cat houdini.env | grep -v "#" | grep "=" | xargs -L1 echo export)
grep -v “#” just filters out comment lines
grep “=” filters for lines actually containing an assigment
xargs -L1 echo export just prints each line with “export” prepended.
So you get output like
export HOUDINI_NO_SPLASH=1
Wrapping the whole command in $() will execute the whole thing as a shell command.
Bash also requires that there's no space around the =. Just make sure of that in your file, I didn't take care of that in the one-liner.
Kai Stavginski
Senior Technical Director
SideFX
Senior Technical Director
SideFX
- gadfly16
- Member
- 65 posts
- Joined: May 2009
- Offline
-
- Quick Links