当前位置: 首页 > news >正文

mac iterm2 rz sz 无法上传下载问题

一、问题状况

在mac上使用brew install lrzsz命令安装后,根据网上一些文章的步骤,修改iterm2的Triggers。但是在远程服务器上执行rz命令,想将本地文件上传到服务器时,命令卡住了:

$ rz
?**B0100000023be50ive.**B0100000023be50

二、如何解决

1、安装lrzsz

brew install lrzsz##至于mac上brew工具没有安装的的,可以提前安装

2、查看lrzsz工具所在路径

brew list lrzsz  ##这一步很关键,因为路径下存在rz、sz两个工具。
term2-send-zmodem.sh和iterm2-recv-zmodem.sh两个脚本只是对这两个工具的简单封装,

3、下载iterm2-zmodem脚本文件: 脚本地址链接

下载解压后,获取到的就是上述提到的term2-send-zmodem.sh和iterm2-recv-zmodem.sh两个脚本

4、修改脚本

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 domainosascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; thenFILE=`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)&\"\")"`
elseFILE=`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)&\"\")"`
fiif [[ $FILE = "" ]]; thenecho Cancelled.# Send ZModem cancelecho -e \\x18\\x18\\x18\\x18\\x18sleep 1echoecho \# Cancelled transfer
elsecd "$FILE"/usr/local/bin/rz -E -e -b   ##/usr/local/bin/rz这个rz工具路径改为brew list lrzsz 时获取到的路径sleep 1echoechoecho \# Sent \-\> $FILE
fiiterm2-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 domainosascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; thenFILE=`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)&\"\")"`
elseFILE=`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 = "" ]]; thenecho Cancelled.# Send ZModem cancelecho -e \\x18\\x18\\x18\\x18\\x18sleep 1echoecho \# Cancelled transfer
else/usr/local/bin/sz "$FILE" -e -b    ##/usr/local/bin/rz这个rz工具路径改为brew list lrzsz 时获取到的路径sleep 1echoecho \# Received $FILE
fi

5、修改iterm2的Triggers

iterm2工具上:
Settings> Profiles -> Default -> Advanced -> Triggers 的 Edit 按钮修改内容:
rz waiting to receive.\*\*B0100
xxx/iterm2-send-zmodem.sh     ##iterm2-send-zmodem.sh的存放路径\*\*B00000000000000
xxx/iterm2-recv-zmodem.sh    #iterm2-recv-zmodem.sh的存放路径

在这里插入图片描述
至此到远程服务器上,使用rz上传本地文件成功


http://www.mrgr.cn/news/13865.html

相关文章:

  • 设计模式篇(DesignPattern - 创建型模式)
  • 【python】OpenCV—Multi Human Pose Estimation
  • AWS api数据信息获取(boto3)
  • OpenCV小练习:身份证号码识别
  • 力扣228题详解:汇总区间的多种解法与模拟面试问答
  • Springboot + AOP + 注解做全局日志拦截并且排除敏感属性以及接口相应时间
  • 什么情况用Bert模型,什么情况用LLaMA、ChatGLM类大模型,咋选?
  • 虚幻引擎UE5入坑记
  • CANoe Trace界面介绍及Trace界面log显示不全解决方法
  • 重塑视频监控体验:WebRTC技术如何赋能智慧工厂视频高效管理场景
  • 简单工作流(后端部分-spring boot,顺便优化了下ui)
  • QT学习笔记
  • Arm 架构学习
  • Transformer中深度学习技术前提的动态展示
  • Windows系统安装MySQL
  • Swift内存管理:掌握强与弱的智能平衡术
  • [Tomcat源码解析]——源码环境搭建
  • 什么叫登录ip地址?登录ip地址可以更改吗
  • postman请求设置
  • <Rust>egui学习之小部件(三):如何为窗口UI元件设置布局(间隔、水平、垂直排列)?