将文本重定向到通常接受文件重定向的脚本中
我们有一个自定义脚本,可以通过将临时文件重定向到该脚本来运行...
i.e.
Step 1
BASH#echo 'commands' > file
Step 2
BASH#script < file
有没有一种方法可以将过程简化为仅一步...并直接将命令发送到脚本而不使用临时文件?
我尝试执行以下操作:
BASH# script < echo 'commands'
BASH# script < 'commands'
BASH# script < "commands"
但我总是收到一条消息,指出它找不到指定的文件...
任何帮助将不胜感激
We have a custom script that we can run by redirecting a temporary file to that script...
i.e.
Step 1
BASH#echo 'commands' > file
Step 2
BASH#script < file
Is there a way to simplify the process to only one step... and directly send the commands to the script without the use of the temporary file?
I have attempted to do the following:
BASH# script < echo 'commands'
BASH# script < 'commands'
BASH# script < "commands"
But I always get a message that it cannot find the file specified...
Any help would be much appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你刚刚尝试过吗
?
Have you tried just
?
您还可以使用此处文档:
或者如果您只需要发送一行(并且正在使用 bash):
You can also use a here-document:
Or if you only need to send one line (and are using bash):