Results 1 to 6 of 6
i have been trying to write a bash script and i keep getting error something about 4th line all i want to do is send a email that is called ...
- 08-29-2008 #1Just Joined!
- Join Date
- Aug 2008
- Posts
- 4
need help with bash script
i have been trying to write a bash script and i keep getting error something about 4th line all i want to do is send a email that is called mail.txt to all the email addresses it finds in a file called emails.txt this is what i wrote and it doesnt work it gets the emails out of emails.txt and it trys to send them but then goes on about the 4th line could someone please help me ive been at this for days
#!/bin/bash
for email in $(cat emails.txt);do
echo "sending mail to $email"
mail {mail.txt $email -s Surprise}
done
exit 0
please help me im kinda new to all this
- 08-29-2008 #2
Fixed it up
#!/bin/bash
for email in $(cat emails.txt); do
echo "sending mail to $email"
mail -v -s Surprise $email < mail.txt
done
exit 0
There you go...
- 08-29-2008 #3Just Joined!
- Join Date
- Aug 2008
- Posts
- 4
still no working
when executed it says
sending mail to cossworth@hotmail.co.uk
./sendmail.sh : line 4: mail : command not found
sending mail to jh-pc@hotmail.co.uk
./sendmail.sh : line 4: mail : command not found
thanks for helping me with the script first of me reading it just woke up its only 8.30am here in scotland. can you figure out whats wrong any ideas what i could be doing wrong or how i can fix it
- 08-29-2008 #4
Do you have mail installed? Can you run it from the CLI?
Perhaps if you specify the path (run which mail) - most of the time it's /usr/bin/mail
- 08-29-2008 #5Just Joined!
- Join Date
- Aug 2008
- Posts
- 4
its vmware backtrack 3
its vmware backtrack 3 i have installed i have a thing called sendmail in usr/bin/sendmail when i type that from command line i get. recipients names must be specified . i dont have usr/bin/mail
do you have an idea of what kind of directories there will be with me saying backtrack 3 what im trying to do is set up a client side attack ive got a lot of different operating systems and im trying to learn exploits and penetrating testing its one of the lessons on backtrack offsec101 they used bt2 on it though but i thought this would of been the easiest part. hopefully you might know how to help me please
- 08-29-2008 #6Just Joined!
- Join Date
- Aug 2008
- Posts
- 4
me again
on my backtrack 2 vmware machine it has usr/bin/mailmail and usr/bin/mailq and usr/bin/sendmail usr/bin/rmail and i have usr/bin/traptoemail what one is it i should use i suppose i could transfer the scripts to the bt2 one if i had to but if the correct programs are on bt2 and not 3 is there anyway i could install them on bt3 from bt2 because on my asus eee pc i have only bt3 installed and i would like this to do this aswell as my normal desktop pc that i have my vmwares installed on ?? as you can proberly tell im new to linux


Reply With Quote
