I’m using virtualenv (which sets some environment variables). Now, I want to spawn a new terminal window that have the same environment. If I try:
xterm &
I get a new terminal but the environment is the default environment, that is when I enter the following line on the new terminal:
pserve --reload development.ini
I get:
>> pserve: Command not found.
On the other hand, if I execute:
xterm -e pserve --reload development.ini &
It opens a new terminal that runs pserve. So, my questions are:
- How to generally open a new terminal with the same environment
- How can the new terminal find
pservewhen I run it with-eswitch?
To answer your first question, a quick and dirty way of doing it is to use the sh builtin ‘set’ command (more see ‘help set’).
From the old shell:
Then
From the new shell:
You may want to wrap this up in a script or add a couple of functions in your ‘bash.rc’. You may also want to use ‘mktemp(1)’ or similar.