On Wed, Mar 29, 2017 at 05:05:09PM +0200, Torka Noda wrote: > I have a script which opens the applications I want on all my > desks, including gnome-terminal with a few tabs. > > In these tabs, I want to change the current directory (I could > use gnome-terminal's "--working-directory=$HOME/foo", but then > opening a new tab, when this tab is selected, would put me in > this initial directory, while I want to always start in > $HOME...), and run a few simple commands, like do an `ls` to > remind me the current content of the directory, or start `su` > so I only have to input my password... (it may not seem like > much, but doing it everyday for years, sometimes multiple times > a day, gets a bit annoying... plus laziness...).
> gnome-terminal \ > --tab -e 'env PROFILE=su /bin/bash' \ > --tab -e 'env PROFILE=foo /bin/bash' \ > --tab -e 'env PROFILE=bar /bin/bash' \ > --tab OK. This looks reasonable. Or, if you prefer, you could set up several different .bashrc-xxx files and use /bin/bash --rcfile ~/.bashrc-xxx for whichever tab. Or skip the actual files, and embed the commands you actually want into a process substitution. I don't have gnome-terminal to test with, but this works for me: $ xterm -e /bin/bash --rcfile <(echo source ~/.bashrc; echo date) I'm sure you can adapt that to gnome-terminal --tab somehow.