Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash, execute command but continue with interactive session

I want to create an alias for pagsh that will immediately get me the admin kerberos ticket.

The problem is that I can't figure out how to specify a command for the bash to run, but still continue with the interactive session after the command is done.

My current shot is:

alias admin=pagsh -c "bash -c \"kinit [email protected]\""

but bash logically ends right after kinit is done. How can I push a custom command into a begging of an interactive session of bash? I still need to run .bashrc normally, therefore I can't use --rcfile

like image 415
Šimon Tóth Avatar asked Jan 03 '11 13:01

Šimon Tóth


1 Answers

My advice would be using a custom bashrc file with --rcfile that sources your .bashrc, ex :

alias admin=pagsh -c "bash --rcfile myrc"

myrc :

source ~/.bashrc
kinit [email protected]
like image 85
OneOfOne Avatar answered Oct 11 '22 16:10

OneOfOne