Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要通过管道传输数据并使用此数据传输文件,我可以在脚本中执行类似的操作吗?
cat ${1} | ./helper ${1}
如果我写有什么区别
cat ${1} | ./helper < ${1}
"<" 将文件内容添加到您的脚本标准输入
管道还重定向 ./helper 脚本的标准输入的输出
你可以做cat ${1} | ./helper 或./helper < ${1}假设 ${1} 是一个文件名,并在帮助脚本中从 /dev/stdin 访问它
cat ${1} | ./helper
./helper < ${1}