I've been working on a little script that will take data from a json file and will make it into a markdown template. The reading from the files works fine and reading the JSON data. When I print the variables separately it works with no problem. The script creates one file named 'passive-.md' but none of the variables ate placed within the template and it doesn't create a new template for each file it iterates over in the for loop.
#!/bin/bash
for file in *.txt;
do
ip= jq '.ip_str' $file
ports= jq '.ports' $file
os= jq '.os' $file
domains= jq '.domains' $file
vulns= jq '.vulns' $file
isp= jq '.isp' $file
hostname= jq '.hostname' $file
echo "$ip $ports $os $domains $vulns $isp $hostname" # debug to check the values works
output='# IP address ${ip}
#domains: ${domain}
## Hostname: ${hostname}
## Operating system: ${os}
## ISP: ${isp}
# ports ${ports}
#vulns
\~~~
${vulns}
\~~~
## Notes
'
echo "${output}" > ./output/passive-${ip}.md
done