Fish Shell 循环一行命令

5

我不确定如何在fish shell中使用for循环。我总是不得不退出fish并在bash中运行它。

以这个为例:

for i in $(cat subdomains); do curl $i | html2text >> websites

I get:

fish: $(...) is not supported. In fish, please use '(cat)'.
for i in $(cat subdomains); do curl $i | html2text >> websites
         ^

2
Fish不兼容Bash或任何其他Unix shell。它有自己的语法,可以在此处找到文档。下次提问之前请先进行一些研究。 - oguz ismail
2个回答

10
for i in (cat subdomains); curl $i | html2text; end >> websites

答案就在这里。

1
不是答案,而是扩展评论。
相关文档链接:
- 命令替换 - for循环 - 变量 - 列表 请注意,命令替换会返回一个表示命令输出的每一行的值列表。这使得您可以在Python中使用for line in (cat ...),而在bash中可能不太稳定。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接