Sponsored Content
Top Forums Shell Programming and Scripting syntax error near unexpected token `elif' Post 302354688 by proactiveaditya on Saturday 19th of September 2009 11:16:32 AM
Old 09-19-2009
Thanks

Thanks a lot

still wondering how i missed the "then"
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

syntax error at line 33: `elif` unexpected

#!/bin/sh echo "Choose option: e, d, l, t, p, or x." read option if test $option = e then echo "Filename?" read file if test ! -f $file then echo "No such file" else echo "Yes its a file" fi ... (4 Replies)
Discussion started by: hazy
4 Replies

2. UNIX for Advanced & Expert Users

Syntax error near unexpected token

Hi, When I run the below shell script I'm getting the error " syntax error near unexpected token `" Script: REM :: File Name : Refresh_OTL.bat REM :: Parameters : %1 - Region REM :: : %2 - Cube Type REM :: : REM :: Notes : REM ============================== set ENVIRONMENT... (2 Replies)
Discussion started by: tomailraj
2 Replies

3. Shell Programming and Scripting

Syntax error near unexpected token `done'

Hi all, Here is a simple script that is working in one server and is giving a syntax error in other server. Can somebody help me ? #!/bin/bash # ftp files done < $file errors: I tried..with no success: if ; then (21 Replies)
Discussion started by: Lenora2009
21 Replies

4. Shell Programming and Scripting

syntax error near unexpected token `='

Hi all, This is a script which converts hex to bin. However am finding an error while executing syntax error near unexpected token `=' `($hexfile, $binfile) = @ARGV;' I am running using ./fil.pl <hexfile> <binfile> ################################################### # # this script... (3 Replies)
Discussion started by: jaango123
3 Replies

5. Shell Programming and Scripting

Syntax error near unexpected token `}' please help

I'm going mad not being able to get this to work. im assuming its only a simple mistake but its driving me bonkers trying to find it. Please if you can help me it would save me pulling my hair out!! Thanks #!/bin/bash -xv # #Config name="TEST Server" + name='TEST Server'... (6 Replies)
Discussion started by: Fisheh
6 Replies

6. Shell Programming and Scripting

Syntax error near unexpected token 'elif'

Solaris 10 This is my script: #!/bin/bash #Script to print number of users and print list of them NO=`awk < /etc/passwd -F: '{ print $1 }' | wc -l` echo There are $NO users on system. echo "Do you want me to list them? (y or n):" read YORN if ] awk < /etc/passwd -F: '{ print $1 }'... (5 Replies)
Discussion started by: kaustubh
5 Replies

7. Shell Programming and Scripting

Syntax error near unexpected token `('

What do I do here? #!/bin/bash payload=-1 AND 1=IF(21,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,112))),0)# hash=`echo -n $payload md5sum tr -d 'n' sed 'ss-sg' md5sum tr -d 'n' sed 'ss-sg'` curl --data cs2=chronopay&cs1=$payload&cs3=$hash&transaction_type=rebill... (2 Replies)
Discussion started by: iiiiiiiiiii
2 Replies

8. Shell Programming and Scripting

Syntax error near unexpected token `|'

Hi All; I try to write a bash code and I am using command substitution. My code is like: #!/bin/bash IP="10.0.0.1 10.0.0.2" PORT="22 80" USERNAME="admin" SCRIPT_HOST="adminHost" HOME_DIR=/home/admin SCRIPT_DIR=$HOME_DIR/scripts script="sudo /my_remote_script.sh" SSH="/usr/bin/ssh... (7 Replies)
Discussion started by: Meacham12
7 Replies

9. Shell Programming and Scripting

Syntax error near unexpected token `else'

Hello every one!! I don't know where I am going wrong but I am finding it difficult to clear this error of syntax error near unexpected token `else' I am writing a simple shell script to find a file in a directory and if found execute that else return an error to the log file ... (14 Replies)
Discussion started by: masubram
14 Replies

10. Ubuntu

Syntax error near unexpected token `('

detect_mouse_mvt.sh /home/andy/bin/detect_mouse_mvt.sh: line 4: syntax error near unexpected token `(' /home/andy/bin/detect_mouse_mvt.sh: line 4: `fh = file('/dev/input/mice')' #!/bin/bash # # fh = file('/dev/input/mice') while True: fh.read(3) print 'Mouse... (15 Replies)
Discussion started by: drew77
15 Replies
PMDAEVENTARRAY(3)					     Library Functions Manual						 PMDAEVENTARRAY(3)

NAME
pmdaEventNewArray, pmdaEventResetArray, pmdaEventReleaseArray, pmdaEventAddRecord, pmdaEventAddMissedRecord, pmdaEventAddParam, pmdaEvent- GetAddr - utilities for PMDAs to build packed arrays of event records C SYNOPSIS
#include <pcp/pmapi.h> #include <pcp/impl.h> #include <pcp/pmda.h> int pmdaEventNewArray(void); int pmdaEventResetArray(int idx); int pmdaEventReleaseArray(int idx); int pmdaEventAddRecord(int idx, struct timeval *tp, int flags); int pmdaEventAddMissedRecord(int idx, struct timeval *tp, int nmissed); int pmdaEventAddParam(int idx, pmID pmid, int type, pmAtomValue *avp); pmEventArray *pmdaEventGetAddr(int idx); cc ... -lpcp DESCRIPTION
A Performance Metrics Domain Agent (PMDA) that wishes to export event records (or trace records) is encouraged to use a metric of type PM_TYPE_EVENT to encode a group of event records into a single packed array. The packed array of event records format is defined in <pcp/pmapi.h> and consists of a pmEventArray structure, containing a variable number of pmEventRecord structures, each of which contains a variable number of pmEventParameter structures, which in turn may contain a variable length value for each parameter of each event record. The routines described here are designed to assist the PMDA developer in building a packed array of event records, and managing all of the memory allocations required to hold each instance of an array of event records in a contiguous buffer. Normal use would be as part of PM- DA's pmdaFetchCallBack method. pmdaEventNewArray is used to create a new event array. The return value is a small integer that is used as the idx parameter to the other routines to identify a specific event array. If needed, a PMDA can create and use multiple event arrays. To start a new cycle and refill an event array from the beginning, call pmdaEventResetArray. If the PMDA has finished with an event array, pmdaEventReleaseArray may be used to release the underlying storage and ``close'' the event array so that subsequent attempts to use idx will return PM_ERR_NOCONTEXT. To start a new event record, use pmdaEventAddRecord. The timestamp for the event record is given via tp and the flags parameter may be used to set the control field that determines the type of the event record - flags may be the bit-wise ``or'' of one or more of the PM_EVENT_FLAG_* values defined in <pcp/pmapi.h> (but note that PM_EVENT_FLAG_MISSED should not be used in this context). If event records have been missed, either because the PMDA cannot keep up or because the PMAPI client cannot keep up, then pmdaEventAd- dMissedRecord may be used. idx and tp have the same meaning as for pmdaEventAddRecord and nmissed is the number of event records that have been missed at this point in the time-series of event records. pmdaEventAddMissedRecord may be called multiple times for a single batch of event records if there are more than one ``missed event record'' episode. Once an event record has been started by calling pmdaEventAddRecord, one or more event parameters may be added using pmdaEventAddParam. The pmid and type parameters decribe the PMID of the parameter and the data type (one of the PM_TYPE_* values from <pcp/pmapi.h>) of the value that is passed via avp. type should one where the size of the value is implied by the type or by the length of a string value (for PM_TYPE_STRING) or encoded within avp->vbp (for PM_TYPE_AGGREGATE). Once the packed array has been constructed, pmdaEventGetAddr should be used to initialize the ea_type and ea_len fields at the start of the pmEventArray and return the base address of the event array that is assigned to the vp field of the pmAtomValue structure that the pmdaFetchCallBack method should return. EXAMPLE
The following skeletal code shows how these routines might be used. int sts; int myarray; int first = 1; pmEventArray eap; if (first) { first = 0; if ((myarray = pmdaEventNewArray()) < 0) { // report error and fail } } pmdaEventResetArray(myarray); // loop over all event records to be exported ... { struct timeval stamp; int flags; // establish timestamp and set flags to 0 or some combination // of PM_EVENT_FLAG_POINT, PM_EVENT_FLAG_START, PM_EVENT_FLAG_ID, // etc if ((sts = pmdaEventAddRecord(myarray, &stamp, flags)) < 0) { // report error and fail } // loop over all parameters for this event record ... { pmID pmid; int type; pmAtomValue atom; // construct pmid, type and atom for the parameter and // its value if ((sts = pmdaEventAddParam(myarray, pmid, type, &atom)) < 0) { // report error and fail } } // if some event records were missed (could be at the start // of the exported set, or at the end, or in the middle, or // a combination of multiple missed record episodes) ... { int nmiss; struct timeval stamp; if ((sts = pmdaEventAddMissedRecord(myarray, &stamp, nmiss)) < 0) { // report error and fail } } } // finish up eap = pmdaEventGetAddr(myarray); SEE ALSO
pmdaEventNewQueue(3), pmdaEventNewClient(3), PMDA(3) and pmEventFlagsStr(3). Performance Co-Pilot PCP PMDAEVENTARRAY(3)
All times are GMT -4. The time now is 07:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy