一.mac安装lrzsz
brew install lrzsz
二.ubuntu安装lrzsz
sudo apt-get install lrzsz
三.下载iterm2-send-zmodem.sh 和iterm2-recv-zmodem.sh两个脚本
#https://github.com/aikuyun/iterm2-zmodem
#解压后把两个文件都复制到/usr/local/bin/,然后设置权限
cp ./iterm2-send-zmodem.sh /usr/local/bin/iterm2-send-zmodem.sh
cp ./iterm2-recv-zmodem.sh /usr/local/bin/iterm2-recv-zmodem.sh
chmod 777 /usr/local/bin/iterm2-*
四.配置 iTerm2
iTerm2 -> Profiles -> Default ->Advanced -> Triggers -> edit
Regular expression: rz waiting to receive.\*\*B0100
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-send-zmodem.sh
Instant: checked
Regular expression: \*\*B00000000000000
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-recv-zmodem.sh
Instant: checked
疑难杂症1
在本地的“/usr/local/bin”下没有sz和rz,但是brew install lrzsz 已经安装成功
/usr/local/bin/iterm2-send-zmodem.sh: line 18: /usr/local/bin/sz: No such file or directory
brew list lrzsz
查看到安装目录
修改 iterm2-send-zmodem.sh 和 iterm2-recv-zmodem.sh 中的sz和rz的位置
疑难杂症2
重新定义 expect(解决 rz/sz 工具异常的问题)
在~/.bash_profile中添加下列代码:
alias expect='export LC_CTYPE=en_US && expect'
或者可以直接在配置 iTerm2的时候加上export LC_CTYPE=en_US;
参考文献
https://icloudnative.io/posts/iterm2-auto-login/
https://github.com/aikuyun/iterm2-zmodem
https://blog.csdn.net/sinat_24948419/article/details/115095961