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:
~/Document/project1/ops-setup.sh
#!/bin/bash
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
Following @dessert suggestion using a script that includes
bashrc
asinit-file
, here is was I did:~/Document/project1/bash-wrapper.sh
And defined this custom command in the gnome-terminal profile: