I've a .txt
file which contains
abc.com
google.com
....
....
yahoo.com
And I'm interested in loading it to a bash script as a list (i.e. Domain_List=( "abc.com" "google.com" .... "yahoo.com")
). Is it possible to do?
Additional information, once the list is obtained it is used in a for
loop and if
statements.
for i in "${Domain_list[@]}
do
if grep -q "${Domain_list[counter]}" domains.log
....
....
fi
....
let counter=counter+1
done
Thank you,
Update:
I've changed the format to Domain_list=( "google.com .... "yahoo.com" ), and using source Doamin.txt
allows me to use Domain_list
as a list in the bash script.
#!/bin/bash
counter=0
source domain.txt
for i in "${domain_list[@]}"
do
echo "${domain_list[counter]}"
let counter=counter+1
done
echo "$counter"