whats wrong with this bash script:
acme2=$(dig txt @$1 _acme-challenge.$1.de)
acme3=$(echo $acme2 | grep "^_acme")
acme2 has the whole output, but acme3 is always empty
I searched several solutions, and tried other possibilities, but nothing works...
acme3=echo $acme2|grep acme
acme3=$($acme2|grep "^_acme")
acme3=$(grep "acme" $acme2)
acme3=$(echo "$acme2" | grep "^_acme")
$1
? You should post the debug withset -x
printf '%s\n' "$acme2"
. We really can't help you parse data you don't show us. And clarify exactly what you want to do here. What is the expected output? Why are you expecting a line beginning with_acme
?typeset -p acme2
and b) the expected contents ofacme3
echo $acme2
as-is, you'd have seen it folds all the lines into one, perhaps explaining why thegrep
doesn't stick.