我有这个脚本......
#!/bin/sh
list=`/usr/bin/yasql user/xxxx@dev --batch` <<EOT
select h.hostname from host h, server s where s.id = h.id and s.server_type = 'DNS';
EOT
for i in $list
do
echo $i
done
但当然它不起作用,因为我不明白如何将HEREDOC与反引号混合使用``
答案 0 :(得分:2)
list=`/usr/bin/yasql user/xxxx@dev --batch <<EOT
select h.hostname from host h, server s where s.id = h.id and s.server_type = 'DNS';
EOT`