为什么qsub 提交多个pbs 脚本的命令在bash shell 中有效但在fish 中无效?

Why does this command for qsub to submit multiple pbs scripts work in the bash shell but not fish?

我在一个目录中有一堆 .pbs 文件。

我可以在 bash shell 中使用此命令对文件进行 qsub 没问题,但对于鱼 shell,我连续按回车键,它只是创建了一个新的输入行。知道为什么它对鱼不起作用吗?

for file in *.pbs; do qsub $file; done

Fish 的循环语法和其他块结构不同。

在这种情况下是

for file in *.pbs
    qsub $file
end

或者,在一行中:

for file in *.pbs; qsub $file; end

其他循环结构看起来很相似 - 没有介绍性的“do”,它们以“end”结尾。

此处的其他差异:这与带有 nullglob 选项的 bash 的行为类似,因此如果没有文件匹配 for-loop 将不会被执行,则无需保护文字 *.pbs 正在通过。

此外 $file 不需要被引用,因为它被设置为一个元素,因此它将作为一个元素传递,不会发生分词。

Fish 使用与 bash 和其他 shell 不同的脚本语法。阅读它:Fish for bash users 是一个快速的起点,但文档的其余部分值得一读(在我看来,诚然有偏见)。