[英]How to redirect output of a bash script to screen on the fly?
I'm running a one-line script that should have multi-stage output: 我正在运行应具有多阶段输出的单行脚本:
#!/bin/bash
ansible-playbook deploy-master.yml -i ./inventories --private-key=$HOME/.ssh/id_rsa
however it won't show anything until its execution is finished (after which it will print all outputs of ansible-playbook). 但是,在执行完成之前,它不会显示任何内容(在此之后,它将显示ansible-playbook的所有输出)。 How do I fix this?
我该如何解决?
It seems like the easiest solution is to switch shebang line to: 似乎最简单的解决方案是将shebang行切换为:
I don't know the reason but it just worked. 我不知道原因,但是它起作用了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.