I have seen a number of ways how concatenation of variables are supposed to work but they are not working how I would expect and not sure why...
I am reading a txt file into an array
each row is a domain name I want to do an zone transfer output that to a file with the filename domain.zone simple right....
ok well here is the script I have commected out the actual dig part
#!/bin/bash
filecontent=($(cat goodFvzones.txt))
for t in "${filecontent[@]}"
do
n=".zone"
x=$t$n
echo "$x"
#dig @dnsserver -t axfr $t > $x
done
When I run the above script if the domainname it was working on was domain.com what I get as output is: .zonen.com
Expected output would be domain.com.zone
The content of variable n (5 charaters) is overwriting the first 5 charaters of variable t
Can someone explain what I am doing wrong I think it must have something to do with the period but have not been able to figure it out.
CRcharacters in your text file? (Windows or Mac line endings)filecontent=($(cat goodFvzones.txt | tr -d '\r'))while waiting for @AntonKovalenko to suggest that as an answer.