如何区分.bash_profile中的scp和ssh
How to tell the difference between scp and ssh in .bash_profile
我在 .bash_profile
中为远程服务器嵌入了以下行:
export JMXPASS=`sudo /bin/cat /opt/jmxr.pass`
当我通过 ssh 连接到远程服务器时,系统提示我输入密码(预期行为)。但是,当我从这个远程服务器 scp 或到这个远程服务器时,我收到以下错误
sudo: no tty present and no askpass program specified
我想在 .bash_profile 中插入一个 if 条件,其效果为:
if [ssh'ing] then
export JMXPASS=`sudo /bin/cat /opt/jmxr.pass`
fi;
谁能告诉我条件检查需要什么?
~/.bashrc
开头常用的条件是
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
如果 bash 不是交互式的(scp
情况),它将 return
并且在其他情况下 运行 更进一步。
我在 .bash_profile
中为远程服务器嵌入了以下行:
export JMXPASS=`sudo /bin/cat /opt/jmxr.pass`
当我通过 ssh 连接到远程服务器时,系统提示我输入密码(预期行为)。但是,当我从这个远程服务器 scp 或到这个远程服务器时,我收到以下错误
sudo: no tty present and no askpass program specified
我想在 .bash_profile 中插入一个 if 条件,其效果为:
if [ssh'ing] then
export JMXPASS=`sudo /bin/cat /opt/jmxr.pass`
fi;
谁能告诉我条件检查需要什么?
~/.bashrc
开头常用的条件是
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
如果 bash 不是交互式的(scp
情况),它将 return
并且在其他情况下 运行 更进一步。