4
I'm trying to write a simple script that starts a terminal and runs the command workon foo
. In other words, I just want to do:
mate-terminal -e workon foo
However, that doesn't work because the workon
command requires me to first do:
export WORKON_HOME=~/work;
source /usr/local/bin/virtualenvwrapper.sh
Normally those lines are run automatically because they're in my .bashrc
, but evidently mate-terminal -e
doesn't do a source ~/.bashrc
. However, if I try adding those lines to my script:
mate-terminal -e export WORKON_HOME=~/work; source /usr/local/bin/virtualenvwrapper.sh; workon foo
it doesn't work either. MATE tells me:
There was an error creating the child process for this terminal
Failed to execute child process "export" (No such file or directory)
I have the same problem if I skip the export
and just do mate-terminal -e source ...
or if I try to use .
instead of source
(mate-terminal -e . ...
).
I'm not sure how I can load anything if I can't, export
, source
, or .
, but there must be some way because mate-terminal -e
would be almost useless without it.
Does anyone know how I can I setup my environment in a terminal started with mate-terminal -e
?
When I try the first version you provided I got
Failed to parse arguments: Unknown option -c
. So I then tried the second version, and it worked great ... for about 1ms; after that the terminal closed (presumably because the command is finished). So then I tried the script form, and tried executing it both ways you suggested, but it had the same problem (ie. the terminal closed immediately). If you have any suggestions as to how I can fix the terminal-closing-issue I'll happily accept this answer. – machineghost – 2015-09-08T22:41:21.487@machineghost: To avoid the 1ms effect you can put as last line of your script a
– Hastur – 2015-09-09T06:49:50.543read line
(or asleep 10s
) so that the script will wait you press return to end, (or 10 seconds). You can use the same trick after your command in the string of the bash command...; workon foo; read line ...
. In general for many terminal it is possible, see here for example (+), to give a parameter to keep open the terminal. In mate-terminal you can use the profile one--window-with-profile
after that you created one as suggested above (+).Quick note: I also got a "No module named virtualenvwrapper virtualenvwrapper.sh" error, but I fixed it with the answer found here: http://stackoverflow.com/questions/29486113/problems-with-python-and-virtualenvwrapper-after-updating-no-module-named-virtu
– machineghost – 2015-09-30T17:28:53.407