Mac下CoreShell檔案上傳和下載配置
阿新 • • 發佈:2020-12-16
在MAC下,使用CoreShell時,使用lrzsz命令,上傳下載檔案的方法.
在伺服器端或者mac端執行以下操作,在伺服器端配置則每臺伺服器都得配置,在mac端配置完成得重啟CoreShell。
1、新建~/.bashrc_Core_Shell檔案,寫入如下內容
# Bash support for Core Shell, reference: /etc/bashrc_Apple_Terminal on macOS
# Report Working Directory
#
# Tell the Core Shell about the current working directory at each prompt.
if [ -z "$INSIDE_EMACS" ]; then
update_coreshell_cwd() {
# Identify the directory using a "file:" scheme URL, including
# the host name to disambiguate local vs. remote paths.
# Percent-encode the pathname.
local url_path=''
{
# Use LC_CTYPE=C to process text byte-by-byte. Ensure that
# LC_ALL isn't set, so it doesn't interfere.
local i ch hexch LC_CTYPE=C LC_ALL=
for ((i = 0; i < ${#PWD}; ++i)); do
ch="${PWD:i:1}"
if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then
url_path+="$ch "
else
printf -v hexch "%02X" "'$ch"
# printf treats values greater than 127 as
# negative and pads with "FF", so truncate.
url_path+="%${hexch: -2:2}"
fi
done
}
if [ -n "$TMUX" ]; then
printf '\ePtmux;\e\e]7;%s\a\e\\' "file://$HOSTNAME$url_path"
else
printf '\e]7;%s\a' "file://$HOSTNAME$url_path"
fi
}
PROMPT_COMMAND="update_coreshell_cwd${PROMPT_COMMAND:+; $PROMPT_COMMAND}"
fi
2、編輯當前使用者目錄下面.bash_profile檔案(沒有就新建),在.bash_profile檔案的末尾加入下面的內容。
[[ -n "$SSH_TTY" || -n "$SSH_CONNECTION" ]] && [ -r "$HOME/.bashrc_Core_Shell" ] && . "$HOME/.bashrc_Core_Shell"
3、根據Linux系統的不同。如果在當前使用者目錄下面有.bashrc檔案(ubantu和centos系統有),還要在.bash_profile檔案的末尾加入下面的內容。
[ -r "$HOME/.bashrc" ] && . "$HOME/.bashrc"
這個目的是在使用者登陸Linux後,載入.bash_profile檔案的時候載入.bashrc檔案,否則.bashrc檔案的配置不生效。
4、執行命令source .bash_profile重新載入配置。
source .bash_profile