【发布时间】:2017-05-14 01:51:44
【问题描述】:
如何在.sh 文件中获得带有nslookup 的dns mx 记录的结果,它会自动执行所有步骤,而无需询问set type=mx 然后域。我只想执行./file.sh 然后它给我结果。
bash 文件可能是这样的:
#!/bin/bash
nslookup
set type=mx
example.com
但每次我执行文件时,它只运行第一行nslookup,然后再次请求set type=mx 和域。
我使用-q=mx 以另一种方式在stackoverflow 中得到了答案:
#!/bin/bash
nslookup -q=mx example.com
但我希望我的回答使用set type=mx
【问题讨论】:
标签: bash shell stdin heredoc nslookup