Need to add Birthday images inside shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to add Birthday images inside shell script
# 1  
Old 09-11-2014
Need to add Birthday images inside shell script

Hi All- I have written a shell script to send birthday wish mail to all my colleagues.

I need help from you all in two things,

1. I need to add some 17 birthday images as my team size is 17 i want to send different images for everyone. (I dont know how to do it)

2. I need to send mail to 17 people but i know the command to send only 1 at a time

Could you please alter my script according to my requirement and share me?

Thanks,
Bala

Code:
#!/bin/bash
LIMIT=3
IFILE="/apps/fresco/BALACHANDAR/bday.csv"
OFILE="bday_out"$$
MAILID=balachandar.sedouramane@gmail.com
for i in 1 2 $LIMIT
do
arr[$i]=`date '+%d-%b' -d "$i days"`
done
while IFS=",-" read name day month year
do
for DAT in ${arr[@]}
do
DAY=${DAT:0:2}
MON=`echo ${DAT:3:3} | awk '{print toupper($0);}'`
day=`printf "%02d\n" $day`
month=`echo $month | awk '{print toupper($0);}'`
if [ $day -eq $DAY -a $month = $MON ]
then
echo $name : $DAT
break;
fi
done
done < $IFILE > $OFILE
if [ -f $OFILE -a -s $OFILE ]
then
sed -i '1i The users celebrating their birthday are:\n' $OFILE
mailx -s "Birthday List: " $MAILID < $OFILE
\rm $OFILE
echo "Birthday mail sent"
else
echo "No birthdays."
fi

---------- Post updated at 07:22 AM ---------- Previous update was at 07:20 AM ----------

Bday.csv file :

Happy Birthday BALA11-Sep-89User207-Jul-89User315-Jun-95

Last edited by ChandruBala73; 09-12-2014 at 07:11 AM..
# 2  
Old 09-11-2014
1. and 2. are mutually exclusive. You can either send one mail with all the same attachment(s) to n people, or you can send individual mails to n different people with a different attachment in each.
man mail is your friend.
# 3  
Old 09-11-2014
Okay then send one mail with all the same attachment(s) to n people is fine for me

Can you please revise my code and send with a proper one?
# 4  
Old 09-11-2014
Did you read the mailx man page?
# 5  
Old 09-11-2014
A couple of thoughts...
Add the image file name & path to your bday.csv file, and read it in on that 10th line.
Once you determine (middle of your program) that it is someone's birthday, why not execute the mailx command right there; plus you will know the unique image file to uuencode attach.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture run time of python script executed inside shell script

I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Discussion started by: Adfire
2 Replies

2. Shell Programming and Scripting

How to merge Expect script inside shell script?

Hi I have two scripts one is Expect and other is shell. I want to merge Expect code in to Shell script so that i can run it using only one script. Can somebody help me out ? Order to execute: Run Expect_install.sh first and then when installation completes run runTests.sh shell script. ... (1 Reply)
Discussion started by: ashish_neekhra
1 Replies

3. Shell Programming and Scripting

Bash Script to find/sort/move images/duplicate images from USB drive

Ultimately, I'm looking to create a script that allows me to plug in a usb drive with lots of jpegs on it & copy them over to a folder on my hard drive. So in the process of copying I am looking to hash check them, record dupes to a file, copy only 1 of the identical files (if it doesn't exsist... (1 Reply)
Discussion started by: JonaQuinn
1 Replies

4. Shell Programming and Scripting

Nohup inside shell script

Hi, I want to run another script inside shelll script in nohup mode. let explain. under the same folder ,I have two scripts scrone.sh scrtwo.sh In scrone.sh if then nohup ./scrtwo.sh & echo " Script two has been run correctly" else echo " Exiting from the script" fi If... (3 Replies)
Discussion started by: ckchelladurai
3 Replies

5. Shell Programming and Scripting

expect script inside shell script not working.

Shell Scipt: temp.sh su - <$username> expect pass.exp Expect script: pass.exp #!/usr/bin/expect -f # Login ####################### expect "Password: " send "<$password>\r" it comes up with Password: but doesnt take password passed throguh file. (2 Replies)
Discussion started by: bhavesh.sapra
2 Replies

6. Shell Programming and Scripting

how to run shell script inside expect script?

I have the code like this : shell script continues ... .... expect -c" spawn telnet $ip expect "login:" send \"$usrname\r\" expect "Password:" send \"$passwd\r\" expect "*\>" send \"$cmdstr\r\" ... (1 Reply)
Discussion started by: robbiezr
1 Replies

7. Shell Programming and Scripting

Call a perl script inside a shell script

Hi all, I have the following snippet of code.. #!/bin/sh echo "run perl script............" #Run the verification script perl bill_ver echo " perl script completed....." echo "rename files......" #Remove from all file in the directories test, test1, test2, test3 for f in... (3 Replies)
Discussion started by: chriss_58
3 Replies

8. Shell Programming and Scripting

invoking a shell script inside cgi shell script

Hi, I have an HTML form through which I get some text as input. i need to run a shell script say script.sh inside a perl-cgi script named main_cgi.sh on the form input. I want to write the contents of the form in a file and then perform some command line operations like grep, cat on the text... (2 Replies)
Discussion started by: smriti_shridhar
2 Replies

9. Shell Programming and Scripting

rlogin inside a c-shell script

Hi Forumers, Sorry if it's really simple, but I couldn't find a way out. :( I've to do something like this in a script (csh): <some commands, variable settings, scripts> rlogin different_server <some commands, variable settings, scripts> After "rlogin", it shows the prompt of the... (5 Replies)
Discussion started by: sumitgarg
5 Replies

10. Shell Programming and Scripting

How to run unix commands in a new shell inside a shell script?

Hi , I am having one situation in which I need to run some simple unix commands after doing "chroot" command in a shell script. Which in turn creates a new shell. So scenario is that - I need to have one shell script which is ran as a part of crontab - in this shell script I need to do a... (2 Replies)
Discussion started by: hkapil
2 Replies
Login or Register to Ask a Question