重击,执行命令,但继续进行交互式会话 [英] Bash, execute command but continue with interactive session
问题描述
我想为pagsh
创建一个别名,该别名将立即为我提供管理员kerberos凭单.
I want to create an alias for pagsh
that will immediately get me the admin kerberos ticket.
问题是我无法弄清楚如何为bash
指定要运行的命令,但是在完成命令后仍然继续进行交互式会话.
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.
我当前的镜头是:
alias admin=pagsh -c "bash -c \"kinit xtoth1@ADMIN.META\""
,但bash
逻辑上在kinit
完成后立即结束.如何将自定义命令推入bash交互式会话的乞讨中?我仍然需要正常运行.bashrc,因此不能使用--rcfile
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
推荐答案
我的建议是使用带有--rcfile
的自定义bashrc文件,该文件可提供.bashrc的源代码,例如:
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 xtoth1@ADMIN.META
这篇关于重击,执行命令,但继续进行交互式会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!