I am writing a simple script to send emails using mail command.
The problem is: I want it to, when given -A argument, send multiple mails to recipients listed as -A following arguments. Each recipient receives a mail containing text from adr(recipient_nr).txt
i=`expr "$#" - 1`
if [ "$1" = "-A" ]
while [ "$i" != 0 ]
mail -s test_sub ? < adr$i.txt
#tried a few things there but couldn't make it work...
cat adr$i.txt >> arch.txt
(( i-- ))
(( j-- ))
Some parts of the code might be leftovers after experimenting with it.