[英]How do I run a command on login and have it appear in the console?
例如,让它在我登录时立即运行tmux attach -d。 .bashrc,.profile等似乎在后台运行它? 我想查看登录后立即在终端中运行的操作。 我试图在运行命令的.ssh中将command =“ echo 1”条目添加到authorized_keys中,从而运行命令并注销我,这不是我想要的。
要在启动登录shell时立即作为.bashrc
一部分运行某些内容,请将其作为最后几行:
if shopt -q login_shell; then
exec tmux attach -d
# run exit if you want to be logged out if the exec fails, otherwise omit
exit
fi
但是,这将意味着您不会被转储到实际的bash
shell中,并且当tmux
退出时,您将被注销。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.