• 「MAC神操作」iterm2进行跳板机到服务器到上传和下载


    以前在windows上习惯于用xshell,即使有跳板机也可以上传和下载,不需要使用scp

    后来换mac了,十分不方便,同事先推荐使用app transmit,logo是一辆小货车,

    碰巧发现网上也有类似xshell 通过上传/下载  「rz/sz」的配置方法。

    具体如下,亲测有效。

    1. 服务器首先支持rz/sz命令

    brew install lrzsz

    2.Mac上安装安装Iterm2

    3.编写shell脚本用于上传和下载

    上传: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
    
    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)&"")"`
    if [[ $FILE = "" ]]; then
        echo Cancelled.
        # Send ZModem cancel
        echo -e \x18\x18\x18\x18\x18
        echo # Cancelled transfer
        echo
    else
        echo $FILE
        cd "$FILE"
        /usr/local/bin/rz
        echo # Received $FILE
        echo
    fi
    

      

    下载: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
    
    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)&"")"`
    if [[ $FILE = "" ]]; then
        echo Cancelled.
        # Send ZModem cancel
        echo -e \x18\x18\x18\x18\x18
        echo # Cancelled transfer
        echo
    else
        echo $FILE
        /usr/local/bin/sz "$FILE"
        echo # Received $FILE
        echo
    fi
    

      

    最好放在目录 /usr/local/bin/下,因为脚本里面写死了这个目录。

    并给这两个shell文件加上预定的权限,比如简单粗暴的chmod 777 iterm2*

    4. 配置Iterm2中的Triggers,具体入口是Perferences的Profiles标签页的Advanced标签页下面,Triggers点击Edit,然后新增如下,保存即可

        配置项:
    
        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
    

      

  • 相关阅读:
    实验4 IIC通讯与EEPROM接口
    实验3 串口通信
    实验2 中断和定时计数器实验
    实验1 单片机IO口应用及数码管显示
    央行大小额支付系统
    银行各交易渠道的清算方式
    ATM跨行取款的清算方式
    POS机刷卡跨行交易的清算方式
    商业银行在CNAPS体系中对各种交易的处理
    支付相关名词解释
  • 原文地址:https://www.cnblogs.com/qianjinyan/p/11956456.html
Copyright © 2020-2023  润新知