从xshell打开/调用xftp时,不跳转当前shell目录的问题

By | 2024-04-26

部分系统默认设置中,从xshell中打开xftp时,无法跳转到xshell中的当前目录,xftp默认打开的是/home目录。

解决方案:编辑/root/.bashrc文件,添加一行并保存

Bash
# 添加一行
cat <<'EOF' >> /root/.bashrc
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
EOF

# 重新加载
source /root/.bashrc

如下图所示

然后执行 source /root/.bashrc 重新加载.bashrc

参考链接:

https://netsarang.atlassian.net/wiki/spaces/ENSUP/pages/1076133906/How+does+Xshell+determine+the+current+working+directory+when+calling+Xftp

https://netsarang.atlassian.net/wiki/spaces/ENFA/pages/1314560808/Open+Xftp+from+Xshell+with+current+directory+6

Leave a Reply

Your email address will not be published. Required fields are marked *