Send string to stdin

前端 未结 6 1666
北海茫月
北海茫月 2020-11-27 09:48

Is there a way to effectively do this in bash:

/my/bash/script < echo \'This string will be sent to stdin.\'

I\'m aware that I could pip

6条回答
  •  眼角桃花
    2020-11-27 10:18

    cat | /my/bash/script
    

    Enables one to type multiple lines into a program, without that input being saved in history, nor visible in ps. Just press Ctrl + C when finished typing to end cat.

提交回复
热议问题