A bash scripting question



How Can I simplify/perfect the following script, so that I read _ALL_ the
lines in the file and act on the content as shown below, so that I do not
have to specifiy an action per line?

This below is doing exactly what i need BUT reading one line at a time
untill the 10th line, if i want more i add manually...
This might help some1 someday! But if there is a way to perfect it please
do so.....

#!/usr/local/bin/bash

smsfile=email_to_sms
`grep Subject /var/spool/mail/sms >>$smsfile`
if [[ -s $smsfile ]] ; then
cat /dev/null > /var/spool/mail/sms
sed -i 's/Subject: //g' $smsfile
echo `sed -n '1p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==1
{print $1}' $smsfile`
echo `sed -n '2p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==2
{print $1}' $smsfile`
echo `sed -n '3p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==3
{print $1}' $smsfile`
echo `sed -n '4p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==4
{print $1}' $smsfile`
echo `sed -n '5p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==5
{print $1}' $smsfile`
echo `sed -n '6p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==6
{print $1}' $smsfile`
echo `sed -n '7p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==7
{print $1}' $smsfile`
echo `sed -n '8p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==8
{print $1}' $smsfile`
echo `sed -n '9p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==9
{print $1}' $smsfile`
echo `sed -n '10p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==10
{print $1}' $smsfile`
else
echo "***********Sorry the SMS FILE "$smsfile" is empty.************"
fi
gammu-smsd start
cat email_to_sms >> email_to_sms2
cat /dev/null > email_to_sms




--
Best regards,
Odhiambo WASHINGTON,
Nairobi,KE
+254733744121/+254722743223
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
I can't hear you -- I'm using the scrambler.
_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Conflict Between McAffee and ACT
    ... For those not familiar with the product, ACT is a contact ... McAfee VirusScan or Internet Security software installed. ... you will need to disable the Hawk Script Stopper ... OutLook Hawk (the script blocking component) to ignore ...
    (microsoft.public.security.virus)
  • Re: A silly TV movie writing question....
    ... 120min air time or 120min programme time? ... I was thinking air time. ... time vs. script length. ... I was sort of used to thinking in terms of four act or five act ...
    (rec.arts.sf.tv.babylon5.moderated)
  • Re: Conflict Between McAffee and ACT
    ... You should post this at the McAfee Support Forum: ... > For those not familiar with the product, ACT is a contact ... you will need to disable the Hawk Script Stopper ...
    (microsoft.public.security.virus)
  • Re:Re: Video editing program
    ... I used to think you were a trool on tclug. ... Did i act like t? ... am sorry i will try not to troll again. ... abye explaining why will work better then that annoying sh script! ...
    (Ubuntu)
  • Re: Need some pointers on how i can accomplish my idea for a website
    ... want to act very similar to how the "start" button works for windows. ... it would open a box in the browser. ... What if my screen doesn't show your bottom? ... many of the top notch script sites are ancient and the ...
    (alt.html)