Redirect STDIN in bash?

醉酒当歌 提交于 2019-12-01 18:08:01
Matthew Flaschen

Normally, it's just:

echo password|command

But many programs, including MySQL, that read passwords don't actually read from stdin. Rather, they interact with the terminal directly. See Trick an application into thinking its stdin is interactive, not a pipe.

command <<< "input"

That's a bashism and echo solution is more common in scripts, though my solution can be more handy in an interactive shell (and I doubt any of these solutions works with mysql, but your question is more general).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!