Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jul 2006 21:43:56 +1000
From:      "Murray Taylor" <MTaylor@bytecraft.com.au>
To:        <freebsd-questions@freebsd.org>
Subject:   A question for the AWK wizards
Message-ID:  <04E232FDCD9FBE43857F7066CAD3C0F11EEAFA@svmailmel.bytecraft.internal>

next in thread | raw e-mail | index | archive | help
Hi all,

I have a shell script which is called with an arbitrary=20
message argument. Punctuation excludes * ? & | > < chars.

It processes it via an AWK command line 'script' and dumps the=20
result in a file for the SMS sender...

Nice and simple.

Except that the AWK script seems to duplicate the last character or two
in the message. Everything else in the 200 odd lines of shell scripts
surrounding this function run just fine, and this bit runs too,=20
but this tiny thing is _VERY_ annoying.

The shell code is listed below.

Please teach me what bit I missed .... (C and TCL are my forte, not AWK)

cheers
mjt

------------------8<------------------------------
# sourced into other scripts that need to SMS
# !! 4 space indents, NOT tabs !!
#
# generate the sms message
# the awk code forces the message to be < 160 chars
sendsms() {
=20   msg=3D$1

=20   case ${sms_enable} in
=20   [Yy][Ee][Ss])
=20       for phone in ${phonelist}
=20       do
=20           tmpfile=3D`mktemp -t sms`
=20           echo ${phone} >> ${tmpfile}
=20           ${AWK} '{ printf "%-0.159s", $0 }' >> ${tmpfile} << EOF2
`echo $msg`
EOF2

=20           mv ${tmpfile} ${gsmspool_dir}
=20       done
=20       ;;
=20   *)
=20       ;;
=20   esac
}
------------------8<------------------------------

Murray Taylor

Special Projects Engineer
Bytecraft Systems

P: +61 3 8710 2555
F: +61 3 8710 2599
D: +61 3 9238 4275
E: mtaylor@bytecraft.com.au=20


--

"Any intelligent fool can make things bigger and more complex... It
takes a
touch of genius - and a lot of courage to move in the opposite
direction."
--Albert Einstein=20

---------------------------------------------------------------
The information transmitted in this e-mail is for the exclusive
use of the intended addressee and may contain confidential
and/or privileged material. Any review, re-transmission,
dissemination or other use of it, or the taking of any action
in reliance upon this information by persons and/or entities
other than the intended recipient is prohibited. If you
received this in error, please inform the sender and/or
addressee immediately and delete the material.=20

E-mails may not be secure, may contain computer viruses and
may be corrupted in transmission. Please carefully check this
e-mail (and any attachment) accordingly. No warranties are
given and no liability is accepted for any loss or damage
caused by such matters.
---------------------------------------------------------------

***This Email has been scanned for Viruses by MailMarshal.***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?04E232FDCD9FBE43857F7066CAD3C0F11EEAFA>