Switch from file contents to STDIN in piped command? (Linux Shell)

前端 未结 4 1468
南旧
南旧 2020-12-31 22:28

I have a program (that I did not write) which is not designed to read in commands from a file. Entering commands on STDIN is pretty tedious, so I\'d like to be able to autom

4条回答
  •  我在风中等你
    2020-12-31 23:27

    I would do something like

    (cat your_file_with_commands; cat) | sh your_script
    

    That way, when the file with commands is done, the second cat will feed your script with whatever you type on stdin afterwards.

提交回复
热议问题