Mac下CoreShell文件上传和下载配置

在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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值