![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Zipping | dreams5617 | UNIX for Dummies Questions & Answers | 1 | 02-11-2007 08:03 PM |
| Limitations of a file size for zipping | ramky79 | AIX | 1 | 01-19-2007 10:23 PM |
| zipping in a loop | kotasateesh | Shell Programming and Scripting | 2 | 01-10-2007 08:14 AM |
| Zipping the dir | dreams5617 | Shell Programming and Scripting | 1 | 07-26-2006 12:20 AM |
| zipping across platforms | MizzGail | UNIX for Dummies Questions & Answers | 8 | 05-19-2005 01:01 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi ,
I have written code which will ask the subject,body of the mail, attachment and mail id of the receipient. Code will pick up 4 files zip it. It will zip all the files and then post the mail to the receipient. While zipping the file i am getting error. Can anyone help me with this. #!/bin/Sh ##Parameters to be passed echo 'What subject do you want to put for mail' read subject echo 'Pass the path of the text file containing the body of the mail' read body echo 'Pass the path of the files need to be attached' read attachment_path echo 'Pass the mail id' read mail_receiver ##Start of Program cd $attachment_path echo 'current path is' `pwd` ## Count and initialize parameters count=`ls|wc -l` echo 'count is '$count a=0 ##introduced while loop to pick up the first 4 files and zip. Delete the files that are already zipped and pick the other file ## to be zipped while [ $count -gt 0 ] do ls|head -4 > zipfiles cat zipfiles sed - e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/AbcdeFghIjklmnopqRstuvwxyz/' -e "s/^/\'/" -e "s/$/\'/" <zipfiles> zfile list_of_file=`cat zfile` echo $list_of_file a=`expr $a + 1` zip Snaps[$a] $list_of_file rm $list_of_file count=0 echo 'Files zipped' rm zfile done ## This block send the mail to the receiver. file=`ls` echo 'count of zip file -' $file for i in $file do echo $i var=$i ( cat $body uuencode $var $var ) | mailx -s "$subject" ${mail_receiver} done ***************************------********************** While Executing this I am getting error : current path is /export/home/jmirani/MAILExample/attach count is 120 First month of RIA 001.jpg First month of RIA 002.jpg First month of RIA 003.jpg First month of RIA 004.jpg 'First month of RIA 001.jpg' 'First month of RIA 002.jpg' 'First month of RIA 003.jpg' 'First month of RIA 004.jpg' mail.sh[57]: 'First: not found zip error: Nothing to do! (Snaps[1].zip) 'First: No such file or directory month: No such file or directory of: No such file or directory RIA: No such file or directory 001.jpg': No such file or directory 'First: No such file or directory month: No such file or directory of: No such file or directory RIA: No such file or directory 002.jpg': No such file or directory 'First: No such file or directory month: No such file or directory of: No such file or directory RIA: No such file or directory 003.jpg': No such file or directory 'First: No such file or directory month: No such file or directory of: No such file or directory RIA: No such file or directory 004.jpg': No such file or directory Files zipped All though files have been put into string still zip takes the wrong file name. Any help with this is much appreciated. I tried zip trial 'First month of RIA 001.jpg' 'First month of RIA 002.jpg' 'First month of RIA 003.jpg' 'First month of RIA 004.jpg' and this works properly.But code doesn't work? |
|
||||
|
space in sed was my copy paste mistake.
I am also doinf echo before zipping and i am getting : 'First month of RIA 001.jpg' 'First month of RIA 002.jpg' 'First month of RIA 003.jpg' 'First month of RIA 004.jpg' Every file is surrounded by quotes and should be picked up correctly while zipping but not getting picked. Can someone help mw with why zip command is not picking up the files peoperly. I tried this maually zip <ZIPFILENAME> 'First month of RIA 001.jpg' 'First month of RIA 002.jpg' 'First month of RIA 003.jpg' 'First month of RIA 004.jpg' above commna dworked properly and created <ZIPFILENAME>.zip Help HelpHelp!!!!!!!! |
![]() |
| Bookmarks |
| Tags |
| mailx, mailx attachment |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|