Set environmental variable for different profiles

Asked by Alberto Cardellino

Hi guy,

Is there a way to set-up different env vars depending on the profile?
Maybe it do exist and I dont't find it.
I tried to set-up a custom command "export VAR=foo" in the laypout tab, but it just crash at the launch.

Simply having a env var that say TERMINATOR_PROFILE=foo will be enough for me.

Then I can use it to check in my .bashrc (as I do now with gnome-terminal)

if [ "$TERMINATOR_PROFILE" == "foo" ]; then
   do stuff
else
 do other stuff
fi

Thanks for this great tool!!

Question information

Language:
English Edit question
Status:
Solved
For:
Terminator Edit question
Assignee:
No assignee Edit question
Solved by:
Alberto Cardellino
Solved:
Last query:
Last reply:
Revision history for this message
Stephen Boddy (stephen-j-boddy) said :
#1

When you set the custom command you **replace** the normal bash that gets started. I haven't tried it, but I think you should be setting the custom command in layout to:
export VAR=foo; /bin/bash
(the bash might need additional options like -i and/or -l)

Without the bash part the export runs, finishes and exits. It isn't crashing, just not doing what you are expecting.

Revision history for this message
Alberto Cardellino (alberto-carde) said :
#2

Using the command like you said it works fine.

Thanks a lot.
Alberto

2013/11/26 Stephen Boddy <email address hidden>

> Your question #239641 on Terminator changed:
> https://answers.launchpad.net/terminator/+question/239641
>
> Status: Open => Answered
>
> Stephen Boddy proposed the following answer:
> When you set the custom command you **replace** the normal bash that gets
> started. I haven't tried it, but I think you should be setting the custom
> command in layout to:
> export VAR=foo; /bin/bash
> (the bash might need additional options like -i and/or -l)
>
> Without the bash part the export runs, finishes and exits. It isn't
> crashing, just not doing what you are expecting.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/terminator/+question/239641/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/terminator/+question/239641
>
> You received this question notification because you asked the question.
>

Revision history for this message
Alberto Cardellino (alberto-carde) said :
#3

Well... actually not yet.

It's ok for the first shell opened by the terminator, but when I do
CRTL + SHIFT + E or O to split and it up, the variable is gone... so this
solution it is not enough.

Aany other ideas?

2013/11/28 Alberto Cardellino <email address hidden>

> Your question #239641 on Terminator changed:
> https://answers.launchpad.net/terminator/+question/239641
>
> Status: Answered => Open
>
> You are still having a problem:
> Using the command like you said it works fine.
>
> Thanks a lot.
> Alberto
>
>
> 2013/11/26 Stephen Boddy <email address hidden>
>
> > Your question #239641 on Terminator changed:
> > https://answers.launchpad.net/terminator/+question/239641
> >
> > Status: Open => Answered
> >
> > Stephen Boddy proposed the following answer:
> > When you set the custom command you **replace** the normal bash that gets
> > started. I haven't tried it, but I think you should be setting the custom
> > command in layout to:
> > export VAR=foo; /bin/bash
> > (the bash might need additional options like -i and/or -l)
> >
> > Without the bash part the export runs, finishes and exits. It isn't
> > crashing, just not doing what you are expecting.
> >
> > --
> > If this answers your question, please go to the following page to let us
> > know that it is solved:
> >
> >
> https://answers.launchpad.net/terminator/+question/239641/+confirm?answer_id=0
> >
> > If you still need help, you can reply to this email or go to the
> > following page to enter your feedback:
> > https://answers.launchpad.net/terminator/+question/239641
> >
> > You received this question notification because you asked the question.
> >
>
> --
> You received this question notification because you asked the question.
>

Revision history for this message
Alberto Cardellino (alberto-carde) said :
#4

Ok, it indeed works if the custom command is place in the profile tab instead of the layout tab.