Red Cricket
Red Cricket

Reputation: 10470

how to mix HEREDOC with backticks ``?

I have this script ...

#!/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

But of course it does not work because I don't understand how to mix the HEREDOC with backticks ``

Upvotes: 2

Views: 644

Answers (1)

John Kugelman
John Kugelman

Reputation: 361615

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`

Upvotes: 2

Related Questions