Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

while script

Status
Not open for further replies.

biondo68

Technical User
Jul 4, 2003
103
IT
var=10
while test $var 1= "0"
do
let var = var -1
if test "$var" = "0"
then
exit
else
for i in $(cat listat.txt)
mail -s&quot;prova&quot; $i < /etc/hosts.txt
done
fi
done

The problem is the infinity loop ...

i want sent 10 e-mail for each address write in &quot;listst.txt&quot;

thanks

biondo68
 
Code:
var=10
while test $var -gt 0; do
  let var = var - 1
  for i in $(cat listat.txt)
    mail -s&quot;prova&quot; $i < /etc/hosts.txt
  done
done


Hope This Help
PH.
 
I hope to decrease the loop .. var is 10 after the 9..8 ..7..3..1..0 end the script , in this case i sent n° 10 e-mail
at the list of account insert in listat.txt

please

thanks


biondo68
 
Code:
for var in 9 8 7 6 5 4 3 2 1 0 10; do
  mail -s&quot;prova&quot; $i < /etc/hosts.txt
done



Hope This Help
PH.
 
Oops. I've clicked to fast :)
Finally, I don't understand the role of 'var' in the mail
 
i hope a script that decrease , whit

var=10
WHILE test $var -gt 0
do
let var=var -1

after this cycle , I hope to sent with a &quot;for&quot; where a listat.txt contain a list of mail address.

after 10 cycle the script end
 
var=10
WHILE test $var -gt 0
do
let var=var -1
( the results of this cycle is 10.9.8.7.6 ... end )
( this permit to create a cycle compose with 10 cycle , that permit to send with a &quot;for&quot; to send e-mail )




after this cycle , I hope to sent with a &quot;for&quot; where a listat.txt contain a list of mail address.

after 10 cycle the script end


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top