重击,执行命令,但继续进行交互式会话 [英] Bash, execute command but continue with interactive session

查看:72
本文介绍了重击,执行命令,但继续进行交互式会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆