Re: [SLUG] script error driving me crazy

From: Kwan Lowe (kwan@digitalhermit.com)
Date: Tue Mar 16 2004 - 14:51:39 EST


Can you post the script itself? In the section you pasted there appears to be
some syntax errors and typos (extra spaces, no quotes, etc.).

> Fellow Sluggers, I am having a retarded moment with this program I am
> writing. When ever I run it I get an error in the error log that I
> cannot understand. The beginning of the script and part of the error
> log are below. Can anyone see where I have gone wrong?
>

Make sure ${lc} is set before entering the loop... You might also want to
quote it. Should work without, but makes it more robust.

> while [ $lc -le $nl ]
> do
> ppnum=$pnum # move phonenum to prev
> phone num.
> ppext=$pext # move extension to prev
> ext.
> read pnum pext other2
> lc=`expr $lc + 1` # increment num recs read
> # The following statement deals with an account number record following
> a
> # summed time record, and prints out the previous summed information.
>
> ****** The error pertains to this section here, and in particular this
> this if statement.
>
> if [[$pext - gt 299] - a [$ppext - lt 300] - a [$str -eq 1]] ;
> then

You need to put spaces before the $pext. The [[ is considered a statement...

There are other similar problems throughout the script but it would be easier
to debug if I had the full script and some sample data.

-- 
* The Digital Hermit   http://www.digitalhermit.com
* Unix and Linux Solutions   kwan@digitalhermit.com
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:21:37 EDT