Jump to content
Mzigaib

Use hscript to set linux variable

Recommended Posts

Posted (edited)

I am trying to use the 'unix' hscript command to set the 'JOB' variable to my linux shell from inside Houdini but so far no success I got an 'not valid identifier' error if I do this:

unix export JOB=$JOB

I know I could use python but I am trying to use script for this one.

Any tips?

 

Thanks in advance.

Edited by Mzigaib

Share this post


Link to post
Share on other sites

What Bonsak said. Though you should really just do this in Python. Hscript has not been updated in many years, on it's way towards depreciation.

Share this post


Link to post
Share on other sites

I am already used to hscript for years since H9 the reason I never used python it is because I never had to hscript gives me everything I need inside H.

the 'setenv' command only set the environment inside H shell I want to be able to export it to my linux shell with hscript but I think it's not possible and for this case I think you are right python is the way to go.

I can go to the window>shell command that H opens up a shell with the variables that I need but I wanted to be able to do it without have to open another window with script.

Anyway thanks for the feedback.

Share this post


Link to post
Share on other sites

Yeah I migrated from hscript and perl a few years ago. I still don't know why I learned perl... But pipelines are so much more immensely easier to write now. Stack overflow is my hero.

Good Luck Sir!

Share this post


Link to post
Share on other sites

Setting an environment variable applies only to the existing shell process and nothing else. What are you trying to do in the bigger picture that needs this?

Share this post


Link to post
Share on other sites

I just want to send some Houdini environment to the linux shell like the $JOB or the $HIPFILE so I can do stuff in the terminal like "hbatch $HIPFILE" without the have to copy or write any lines from Houdini to the terminal, nothing fancy.

I hope that makes sense.

Share this post


Link to post
Share on other sites

You can't send env. variable back to parent process (shell) from within Houdini. It's not hscript nor Houdini limitation, it's just how system works. Env. variables are inherited by child processes (like Houdini), which means it sees the copy of it. You could start new shell process from Houdini, so that new process will inherit vars as set by you inside Houdini. 

Share this post


Link to post
Share on other sites

Thanks for the info guys, it helps a lot.

The easiest way I do use the 'interchange' environment variables between Houdini and the shell is like I said before I go to window>shell and Houdini creates one for me with the environments that I need. 

PS: I am using Linux.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×