So let's say I'm developing code in directory /asdf/qwer/dfgh/wert/asdf/qwer and I've added about three more directories like that to my path and I have a bunch of arcane environment variables set. Then I realize that I really need another terminal open and set up in just this same way (although this need is not reoccurring so that I would just alter my .bashrc). Is there any command to open a new terminal window that is an exact clone of this one?
|
Cloning the path is easy if you can run your terminal program from the command line. Assuming you're using A quick and dirty way to clone the whole environment (including un-exported variables) is as follows:
If you've set any custom shell options, you'll have to reapply those as well. You could wrap this whole process into an easily-runnable script. Have the script save the environment to a known file, then run Alternately, if you don't want to start one terminal from another, or just want more control, you could use a pair of functions that you define in .bashrc:
EDIT: Changed |
|||||||||
|
|
In a similar situation, I also found it useful to start the new shell in the same directory as the current one. I used a recipe like this to start the shell.
The -t option is needed whenever you explicitly run a shell using ssh. It causes a pseudo-tty to be created for the process. This is necessary for history commands and other interactive features to work correctly. Earlier lines in the script set DIR to the current directory and SHELL to the user's preferred shell. |
||||
|
|
|
If you start a |
|||
|
|