我有一台主机,其.bash_profile文件有一些用户提示(bash read命令),在读取用户的一些输入后,它根据输入执行一些命令.这完全没问题.
现在,当我尝试scp东西到这个主机时,它执行.bash_profile(因为scp首先ssh到远程主机)并且它提示用户输入和scp失败.
我想要的是当有人试图scp到这个主机时跳过执行.bash_profile(我个人认为这不可能)或者知道有人试图scp in .bash_profile(以某种方式在.bash_profile中捕获它)并相应地跳过一些命令.TIA
我在 an answer to a similar question over on the Unix site中找到了解决方案.将此行放在.bashrc或.bash_profile文件的顶部:# If not running interactively, don't do anything [[ $- == *i* ]] || return
精彩评论