I'm trying to use the gnome-terminal profiles to cd to a given directory and register some aliases just after the terminal opens.

I have created a script:


alias up='docker-compose up -d'
alias down='docker-compose stop'

Then a new gnome-terminal Project 1 profile running the following as "custom command"

bash -c "cd ~/Document/project1;. ./ops-setup.sh"

I can see my script launched when I open the terminal with this profile, the terminal remains opened but it does not leave the prompt.

The child process exited normally with status 0.

I tried to add a bash run after it so the prompt remains

bash -c "cd ~/Document/project1;. ./ops-setup.sh";bash

but no alias registered (I guess that's because it is a new process)

I also tried --init-file

bash --init-file <(echo "cd ~/Document/project1;. ./ops-setup.sh")

but bash complains

bash: cd ~/Document/project1;. ./ops-setup.sh): No such file or directory

How can I keep my aliases registered for this Project 1 profile ?

There are multiple ways to keep the terminal opened after running scripts and I that's not my issue. I'm really talking about keeping aliases registered

  • Please explain me how this is a duplicate. I explicitly tell that I'm not trying to run a script without closing the terminal. My issue was not there. Mar 12, 2018 at 10:13

1 Answer 1


Following @dessert suggestion using a script that includes bashrc as init-file, here is was I did:


PROJECT_PATH=`dirname ${BASH_SOURCE[0]}`   

if [ -f ~/.bashrc ]; then
    source ~/.bashrc

source $PROJECT_PATH/ops-setup.sh

And defined this custom command in the gnome-terminal profile:

bash --init-file ~/Documents/project1/bash-wrapper.sh
  • Wow, now I'm getting delete votes here ? For real ? Any explanation ? Is it a really bad answer ? Mar 12, 2018 at 10:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.