Terminal profile registering aliases [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
-2
down vote

favorite













This question already has an answer here:



  • How to run a script without closing the terminal?

    7 answers



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










share|improve this question















marked as duplicate by dessert, karel, Eric Carvalho, waltinator, David Foerster Mar 11 at 19:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 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.
    – Pierre de LESPINAY
    Mar 12 at 10:13














up vote
-2
down vote

favorite













This question already has an answer here:



  • How to run a script without closing the terminal?

    7 answers



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










share|improve this question















marked as duplicate by dessert, karel, Eric Carvalho, waltinator, David Foerster Mar 11 at 19:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 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.
    – Pierre de LESPINAY
    Mar 12 at 10:13












up vote
-2
down vote

favorite









up vote
-2
down vote

favorite












This question already has an answer here:



  • How to run a script without closing the terminal?

    7 answers



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










share|improve this question
















This question already has an answer here:



  • How to run a script without closing the terminal?

    7 answers



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





This question already has an answer here:



  • How to run a script without closing the terminal?

    7 answers







bash gnome-terminal alias






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 14:10

























asked Mar 9 at 13:53









Pierre de LESPINAY

4362727




4362727




marked as duplicate by dessert, karel, Eric Carvalho, waltinator, David Foerster Mar 11 at 19:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by dessert, karel, Eric Carvalho, waltinator, David Foerster Mar 11 at 19:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 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.
    – Pierre de LESPINAY
    Mar 12 at 10:13
















  • 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.
    – Pierre de LESPINAY
    Mar 12 at 10:13















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.
– Pierre de LESPINAY
Mar 12 at 10:13




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.
– Pierre de LESPINAY
Mar 12 at 10:13










1 Answer
1






active

oldest

votes

















up vote
-1
down vote



accepted










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



~/Document/project1/bash-wrapper.sh



#!/bin/bash
PROJECT_PATH=`dirname $BASH_SOURCE[0]`
cd $PROJECT_PATH

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

source $PROJECT_PATH/ops-setup.sh


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



bash --init-file ~/Documents/project1/bash-wrapper.sh





share|improve this answer






















  • Wow, now I'm getting delete votes here ? For real ? Any explanation ? Is it a really bad answer ?
    – Pierre de LESPINAY
    Mar 12 at 10:15

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
-1
down vote



accepted










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



~/Document/project1/bash-wrapper.sh



#!/bin/bash
PROJECT_PATH=`dirname $BASH_SOURCE[0]`
cd $PROJECT_PATH

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

source $PROJECT_PATH/ops-setup.sh


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



bash --init-file ~/Documents/project1/bash-wrapper.sh





share|improve this answer






















  • Wow, now I'm getting delete votes here ? For real ? Any explanation ? Is it a really bad answer ?
    – Pierre de LESPINAY
    Mar 12 at 10:15














up vote
-1
down vote



accepted










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



~/Document/project1/bash-wrapper.sh



#!/bin/bash
PROJECT_PATH=`dirname $BASH_SOURCE[0]`
cd $PROJECT_PATH

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

source $PROJECT_PATH/ops-setup.sh


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



bash --init-file ~/Documents/project1/bash-wrapper.sh





share|improve this answer






















  • Wow, now I'm getting delete votes here ? For real ? Any explanation ? Is it a really bad answer ?
    – Pierre de LESPINAY
    Mar 12 at 10:15












up vote
-1
down vote



accepted







up vote
-1
down vote



accepted






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



~/Document/project1/bash-wrapper.sh



#!/bin/bash
PROJECT_PATH=`dirname $BASH_SOURCE[0]`
cd $PROJECT_PATH

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

source $PROJECT_PATH/ops-setup.sh


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



bash --init-file ~/Documents/project1/bash-wrapper.sh





share|improve this answer














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



~/Document/project1/bash-wrapper.sh



#!/bin/bash
PROJECT_PATH=`dirname $BASH_SOURCE[0]`
cd $PROJECT_PATH

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

source $PROJECT_PATH/ops-setup.sh


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



bash --init-file ~/Documents/project1/bash-wrapper.sh






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 11 at 19:40









David Foerster

26.4k1362106




26.4k1362106










answered Mar 9 at 14:48









Pierre de LESPINAY

4362727




4362727











  • Wow, now I'm getting delete votes here ? For real ? Any explanation ? Is it a really bad answer ?
    – Pierre de LESPINAY
    Mar 12 at 10:15
















  • Wow, now I'm getting delete votes here ? For real ? Any explanation ? Is it a really bad answer ?
    – Pierre de LESPINAY
    Mar 12 at 10:15















Wow, now I'm getting delete votes here ? For real ? Any explanation ? Is it a really bad answer ?
– Pierre de LESPINAY
Mar 12 at 10:15




Wow, now I'm getting delete votes here ? For real ? Any explanation ? Is it a really bad answer ?
– Pierre de LESPINAY
Mar 12 at 10:15


Popular posts from this blog

Unable to execute new pre-installation script (/var/lib/dpkg/tmp.ci/preinst)

Running the scala interactive shell from the command line

Do not install recommended packages of dependencies