Sponsored Content
Top Forums Shell Programming and Scripting Need urgent help with korn shell script Post 302718769 by agama on Saturday 20th of October 2012 09:57:25 PM
Old 10-20-2012
Agree with spacebar -- can be simplified. My thoughts:

Code:
lswpar  | awk '
    /^Name/ { next; }
    /^---/  { next; }
    { state[$2] = state[$2] $1 " "; }
    END {
        printf( "==== WPAR Status Check =====\n" );
        printf( "**** WPAR state Active:\n\t%s\n\n", state["A"] );
        printf( "**** WPAR state Defined/Transition/broken:\n\t%s %s %s\n", state["D"], state["T"], state["B"] );
    }
' | mail -s "WPAR `hostname` Server monitoring Status of Client WPARs" unix_support@xyz.com

As to the reason for your error, you cannot use a shell variable ($i in this case) like you are attempting (in single quotes shell will not expand it). You could try:

Code:
check=$(awk 'FNR == I {print}'  I=$i  /tmp/wpar_state_ck.out)

But I would try something that is much more straight forward than the way you were approaching it.

Last edited by agama; 10-20-2012 at 11:12 PM.. Reason: fixed cut/paste truncation.
This User Gave Thanks to agama For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

demineur in korn shell:urgent.

hello. have please a demineur programmed in shell korn (unix).???? can you send it to me??? thanks. (0 Replies)
Discussion started by: raul
0 Replies

2. UNIX for Advanced & Expert Users

Minesweeper in korn shell:urgent

if you have the programme of Minesweeper;take me it because i need it. thank u very much. (1 Reply)
Discussion started by: raul
1 Replies

3. UNIX for Dummies Questions & Answers

korn shell script

hello., i have 2 files.. 1 file is in this folder /home/test/ssk/DSA.WLG.20050713211544.20050710.20050713211544 (this part) other file is in this folder /home/kk/dev/DSA.WLG.20050711210100.20050710.20050711210100 ... (1 Reply)
Discussion started by: pavan_test
1 Replies

4. UNIX Desktop Questions & Answers

korn shell script

hi all i am writing the korn shell script. i have a SQL script which gives me the folowing output DSA.WLG.20050713211544.20051025.20050713211544 28991 1130198400 DSA.WLG.20050713211544.20051025.20050713211544 25881 1130198400 DSA.WLG.20050711210100.20051025.20050711210100 25881 ... (3 Replies)
Discussion started by: pavan_test
3 Replies

5. AIX

Help with Korn Shell script

I have this Korn shell script that runs via a cron entry. It runs in a loop "watching" a specific file system for files with a certain name. The file system that it is watching is an upload file system for an FTP server. When files that are the correct name come in, it takes the extension of the... (1 Reply)
Discussion started by: heprox
1 Replies

6. Shell Programming and Scripting

Urgent Korn Shell scripting Help Pleaaaase...

Hello All, Can someone help me to set a user's password from the script using korn shell. The password change is a one time password after user account creation. I tried providing the input file as the value for password field but password change requires tty so my password from an input file... (3 Replies)
Discussion started by: solaix14
3 Replies

7. Shell Programming and Scripting

Korn Shell Script

I have to solve some exercises in Korn Shell, but i'm having some problems. For example: Write a korn shell script with an alfanumeric string as argument. The script lists the file's names in the current directory that contain the given string as substring and that can be read and written. I... (3 Replies)
Discussion started by: burm
3 Replies

8. Homework & Coursework Questions

Korn Shell Script

1. The problem statement, all variables and given/known data: Write a korn shell script with an alfanumeric string as argument. The script lists the file's names in the current directory that contain the given string as substring and that can be read and written. 2. Relevant commands, code,... (3 Replies)
Discussion started by: burm
3 Replies

9. Shell Programming and Scripting

pass null value to sql script from korn shell script

There are 4 parameters that I have to pass from korn shell to sql script. 1) I have to check if $1 , $2 , $3 and $4 are null values or not . How can I do that ? 2) Once its determined that these values are null (in the sense they are empty) how can I pass null values to sql script... (11 Replies)
Discussion started by: megha2525
11 Replies

10. Shell Programming and Scripting

URGENT Reading a file and assessing the syntax shell script URGENT

I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies
cfgmgr_get_state(9r)													      cfgmgr_get_state(9r)

NAME
cfgmgr_get_state - General: Determines the configuration state SYNOPSIS
int cfgmgr_get_state( char *driver_name, int *driver_cfg_state ); ARGUMENTS
Specifies the name of the device driver whose configuration state you want to obtain. This name is a string that matches the string you specified for the entry_name item in the /etc/sysconfigtab database. Typically, third-party driver writers specify the driver name (fol- lowed by a colon) in the sysconfigtab file fragment, which gets appended to the /etc/sysconfigtab database during the driver product installation. Returns one of the following state value bits to the driver_cfg_state argument: The specified device driver is in the dynamic configuration state. This means the driver was dynamically configured into the kernel. The specified device driver is in the static configuration state. This means the driver was statically configured into the kernel. DESCRIPTION
The cfgmgr_get_state routine obtains the configuration state of the specified device driver. The specified device driver is in either the static configuration state or the dynamic configuration state. The cfgmgr_get_state routine returns the state value in the driver_cfg_state argument. Driver writers should store this state value in an xx_is_dynamic variable or some similarly named variable. You typically call the cfgmgr_get_state routine in the CFG_OP_CONFIGURE entry point of the device driver's configure routine. RETURN VALUES
Upon successful completion, cfgmgr_get_state returns the value ESUCCESS. This success value indicates that cfgmgr_get_state returned the configuration state of the specified device driver in the driver_cfg_state argument. Otherwise, cfgmgr_get_state returns one of the follow- ing error constants defined in /usr/sys/include/sys/sysconfig.h and /usr/sys/include/sys/errno.h: The device driver that you specified in the driver_name argument does not exist. In this case, cfgmgr_get_state cannot return the configuration state of the specified device driver in the driver_cfg_state argument. The device driver that you specified in the driver_name argument is not a valid name. EXAMPLES
See Writing Device Drivers: Tutorial for a code example of the cfgmgr_get_state interface. SEE ALSO
Routines: cfgmgr_set_status(9r) cfgmgr_get_state(9r)
All times are GMT -4. The time now is 04:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy