繁体   English   中英

zsh:我在 bash 上运行良好的 shell 脚本在 zsh 上不起作用

[英]zsh: my shell script that works well on bash does NOT work on zsh

alias tmutil-rmla='unsetopt multios; echo "tmutil listlocalsnapshots /|sudo tm_removeAllLocalSnapshots" 1>&2; tmutil listlocalsnapshots /|sudo tm_removeAllLocalSnapshots'

而 tm_removeAllLocalSnapshots 是由 macOS 上的 Swift 编译器生成的执行文件。 (我做到了)

别名在 Bash 上运行良好,但最终在 zsh 上“暂停”,如下所示:

% tmutil-rmla  
tmutil listlocalsnapshots /|sudo tm_removeAllLocalSnapshots
zsh: done                    tmutil listlocalsnapshots / | 
zsh: suspended (tty output)  sudo tm_removeAllLocalSnapshots

你能启发我吗?

这是我的发现来解决这个问题的命令: $ setopt nohup

然后我为 bash 编写的脚本很有魅力。

这是一个简单的解决方案,但我必须逐页浏览 zsh 手册,耗时 2 天。 我是 zsh 的新手,在 2 天的时间内完全理解它并不容易。

默认的 bash 脚本在没有命令的情况下挂断了:zsh 有不同的设置。 因此,当我们切换到另一个 shell 时,我们需要注意假设的设置类型。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM