I have a following problem:
#!/bin/bash
NUM=`cat accounts | wc -l`;
for i in {1..$NUM}
do
account=`awk "NR==$i" accounts`;
echo -e "\nAccount: $account\n";
sudo ./backup_maildir $account;
done
"accounts" is a file with regular e-mail addresses, one in each line.
backup_maildir is expect script.
When the main script is executed, the 6th line successfuly echo current mail address, but the following line is not passing that string to backup_maildir script. If the $account variable is [email protected], a string that is passed to backup_maildir is {[email protected]?} ?! How is that possible? How to solve it?
for i in {1..$NUM}
does not work as you expect. If you simply echo $i you get{1..10}
for NUM=10