I have a bash script which getting the data by this:
$ ./script.sh var1 var2 var3
What I want is to have the variables in a text file in the same format like I type in the command line.
input.txt
var1 var2 var3
And I want somehow to feed this txt to my bash script in the command line, not in the bash script:
./script.sh input.txt
How is it possible?
Update:
Here is my script:
#!/bin/bash
DOMAINS=( '.com' '.biz' )
VALUE=$(<input.txt)
INPUT=(`echo "$VALUE"`)
ELEMENTS=${#DOMAINS[@]}
while (( "$#" )); do
for (( i=0;i<$ELEMENTS;i++)); do
whois $1${DOMAINS[${i}]} | grep --perl-regexp --text --null --only-matching --quiet 'Creation Date'
if [ $? -eq 0 ]; then
echo -e "$1${DOMAINS[${i}]}\tregistered\t"
else
echo -e "$1${DOMAINS[${i}]}\tavailable\t"
fi
done
shift
done
As you can see, I tried to implement in the script also, but I'm not a programmer.
The perfect solution would be to remove the used data from input.txt. So if it reads var1 from input.txt, than remove it from there! This can be solved?