mac rz和sz命令

作者: 小黑胖_ | 来源:发表于2018-10-29 17:12 被阅读0次

一、安装brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
二、安装iterm2
brew cask install iterm2
三、安装lrzsz
sudo brew install lrzsz
四、将下面2个脚本保存到 /usr/local/bin/
1.iterm2-recv-zmodem.sh

#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required 
# Remainder of script public domain

osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; then
    FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
else
    FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
fi

if [[ $FILE = "" ]]; then
    echo Cancelled.
    # Send ZModem cancel
    echo -e \\x18\\x18\\x18\\x18\\x18
    sleep 1
    echo
    echo \# Cancelled transfer
else
    cd "$FILE"
    /usr/local/bin/rz -E -e -b
    sleep 1
    echo
    echo
    echo \# Sent \-\> $FILE
fi

2.iterm2-send-zmodem.sh

#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required 
# Remainder of script public domain

osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; then
    FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
else
    FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
fi
if [[ $FILE = "" ]]; then
    echo Cancelled.
    # Send ZModem cancel
    echo -e \\x18\\x18\\x18\\x18\\x18
    sleep 1
    echo
    echo \# Cancelled transfer
else
    /usr/local/bin/sz "$FILE" -e -b
    sleep 1
    echo
    echo \# Received $FILE
fi

五、添加iTerm2 trigger


图片.png
图片.png
图片.png
图片.png

配置项:

Regular expression   Action        Parameters

**B0100        Run Silent Coprocess  /usr/local/bin/iterm2-send-zmodem.sh

**B00000000000000  Run Silent Coprocess  /usr/local/bin/iterm2-recv-zmodem.sh
配置完重启即可使用rz 和sz命令。

相关文章

  • mac rz和sz命令

    一、安装brew/usr/bin/ruby -e "$(curl -fsSL https://raw.github...

  • Linux命令(待修改版本)

    一、 上传下载文件(rz/sz) 首先,你的Linux端(CentOS, Ubuntu)需要安装rz/sz命令,也...

  • liunx 常用命令

    1. sz/rz命令: sz:将选定的文件发送(send)到本地机器rz:运行该命令会弹出一个文件选择窗口 ...

  • 【文件传输】rz命令,windows下使用XShell上传文件至

    一:使用rz命令即可选择要上传的文件 rz -be 使用XShell或者SecureCRT可以用rz、sz命令上下...

  • rz/sz命令

    在使用Linux系统的时候,我们经常需要将本地的文件上传到服务器或者从服务器上下载文件到本地,rz / sz命令很...

  • rz/sz命令

    windows 需要向centos服务器上传文件,可直接在centos上执行命令yum -y install lr...

  • linux 文件传输

    在linux中rz 和 sz 命令允许开发者与主机通过串口进行传递文件了,下面我们就来简单的介绍一下rz 和 sz...

  • Linux命令: sz 和 rz

    lrzsz(sz 和 rz) rz和sz都是使用Zmodem文件传输协议原单词rz: Receive Zmodem...

  • Linux—基础指令

    常用指令: RPM 安装操作命令: RPM 查询操作命令: RPM 卸载操作命令: Linux中rz和sz命令用法...

  • Mac版secureCRT上传和下载的设置

    mac版的secureCRT不能跟windows版一样使用alt+p上传文件,需要使用rz和sz命令才能完成文件的...

网友评论

    本文标题:mac rz和sz命令

    本文链接:https://www.haomeiwen.com/subject/pxtitqtx.html