相关疑难解决方法(0)

我可以使用管道输出作为 shell 脚本参数吗?

假设我有一个 bash shell 脚本Myscript.sh,它需要一个参数作为输入。

但我希望被调用的文本文件的内容text.txt作为该参数。

我试过这个,但它不起作用:

cat text.txt | ./Myscript.sh
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点?

linux bash shell arguments pipe

49
推荐指数
4
解决办法
7万
查看次数

标签 统计

arguments ×1

bash ×1

linux ×1

pipe ×1

shell ×1