Sponsored Content
Top Forums Shell Programming and Scripting Very Basic Question regarding "while" loop Post 302423697 by angshuman_ag on Friday 21st of May 2010 06:02:54 PM
Old 05-21-2010
Quote:
Originally Posted by gaurav1086
Hi,

"while" reads one line at a time "sequentially" until it encounters EOF.
So if another process modifies the file before the while reads/processes the entire data, the behaviour of while loop will change.

Regards,
gaurav.

Hi,
Even I thought so. But I see that is not the behavior. I tried even this

Code:
cat itemList.txt | 
while read item
do
 set $item
 ## do operation with $item
done

In both the cases when my other program makes the itemList.txt as empty, the while loop continues to do the operation till the end. I am using CSHELL on Solaris 8
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. UNIX and Linux Applications

A question/problem about oracle "tns listener" and "enterprise manager"

hi, I have * an IBM P550 machine, * an AIX 5.3 running on it and * an oracle database, already installed on it. The problem (or question of my own) is: Oracle tns listener, "CT_LISTENER", and the enterprise manager (EM) of the instance, which is uniq instance and called... (0 Replies)
Discussion started by: talipk
0 Replies

3. UNIX for Advanced & Expert Users

A question/problem about oracle "tns listener" and "enterprise manager"

hi, I have a problem about the Oracle related components. I'm not able to find any answer yet, and waiting for your responses... Here is the configuration of my system: * an IBM P550 machine, * an AIX 5.3 running on it and * an oracle database, already installed on it. The problem (or... (1 Reply)
Discussion started by: talipk
1 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

Question about the difference between "for" and "while" loop

dear all, i got some questions about for/while loop when working on redirect command output to for/while loop. take one for example : in for loop : allfiles=`find /var/log -maxdepth 1 -type f -mtime +5` index=1 for ((i=0; i<${#allfiles}; i++)); do echo "$index:${allfiles}" ... (2 Replies)
Discussion started by: tiger2000
2 Replies

6. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

7. UNIX for Beginners Questions & Answers

Basic question on "echo"

what happens when I echo asterisk? Please don't hijack other peoples' thread; post our own new one as required by forum rules! (5 Replies)
Discussion started by: ithenr00
5 Replies

8. Shell Programming and Scripting

Failure: if grep "$Var" "$line" inside while read line loop

Hi everybody, I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o My code: #!/bin/sh set -e set -u export IFS= optl="Optl" LOCSTORCLI="/opt/lsi/storcli/storcli" ($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
Discussion started by: Subsonic66
5 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
EvmItemGet(3)						     Library Functions Manual						     EvmItemGet(3)

NAME
EvmItemGet(), EvmItemListFree(), EvmItemListGet(), EvmItemRelease(), EvmItemSet(), EvmItemSetVa() - create and manipulate event items SYNOPSIS
Library EVM Support Library Parameters event The event containing the item to be manipulated. item_id The identifier for the event data item to be set, obtained, or released by the called routine. Possible values for this op- erand, and the data contained by the data item are identified in the following list. See the EvmEvent(5) manpage for a description of the event data items. Identifier Data Item ----------------------------------------------------- EvmITEM_NONE None (Control use) EvmITEM_NAME Event name EvmITEM_PRIORITY Priority EvmITEM_PID Process identifier EvmITEM_PPID Parent process identifier EvmITEM_EVENT_ID Event identifier EvmITEM_TIMESTAMP Time posted EvmITEM_REPEAT_COUNT Repeat count EvmITEM_LAST_TIMESTAMP Last timestamp EvmITEM_I18N_MSG_ID I18N message identifier EvmITEM_I18N_SET_ID I18N message set identifier EvmITEM_I18N_CATALOG I18N catalog EvmITEM_HOST_IP Host IP address EvmITEM_HOST_NAME Host name EvmITEM_USER_NAME User name EvmITEM_FORMAT Event format EvmITEM_REF Reference EvmITEM_VAR Variables EvmITEM_KERNEL_ONLY Kernel distribution Only ----------------------------------------------------- It is also possible to supply a separate item_id for each of the supported variable types. In these cases, an extra one or two op- erands (depending on the type) must be supplied in addition to the item_value. See the description below for more information. The following extended variable item IDs are supported: Identifier Variable Type Parameters ------------------------------------------------------------------- EvmITEM_VAR_CHAR EvmTYPE_CHAR Name, value EvmITEM_VAR_INT16 EvmTYPE_INT16 Name, value EvmITEM_VAR_INT32 EvmTYPE_INT32 Name, value EvmITEM_VAR_INT64 EvmTYPE_INT64 Name, value EvmITEM_VAR_UINT8 EvmTYPE_UINT8 Name, value EvmITEM_VAR_UINT16 EvmTYPE_UINT16 Name, value EvmITEM_VAR_UINT32 EvmTYPE_UINT32 Name, value EvmITEM_VAR_UINT64 EvmTYPE_UINT64 Name, value EvmITEM_VAR_FLOAT EvmTYPE_FLOAT Name, value EvmITEM_VAR_DOUBLE EvmTYPE_DOUBLE Name, value EvmITEM_VAR_STRING EvmTYPE_STRING Name, value EvmITEM_VAR_STRING_I18N EvmTYPE_STRING Name, value, I18N msgid EvmITEM_VAR_OPAQUE EvmTYPE_OPAQUE Name, value, size ------------------------------------------------------------------- item_value The value stored into the item indicated by the associated item_id. For this is the location where the value extracted from the event is stored. item_count This is the return operand. It is the number of entries in item_list, exclusive of the terminating entry. DESCRIPTION
These routines manipulate data in the standard items in an event. The routine sets the value of the event data item specified by item_id to the item_value supplied by the caller. The routine sets item values in the event. The list of item_id and item_value operands is terminated by an instance of item_id of The inclusion of extended variable item-IDs simplifies programming by allowing variable items to be added to an event without first having to set up an structure, or to release it afterwards. To use these extended item-IDs, follow each with the name of the variable, then a value of the appropriate type. In addition, an value must be followed by an I18N message ID, and an value must be followed by a size. The routine returns, in the item_value reference argument, the value of the event data item specified by item_id. The caller must use to free any space allocated for the item. The routine releases any storage space that was allocated when the data item named by item_id was retrieved from an event using The routine returns, in the itemList reference argument, a list of all of the items, which are currently defined for the event. The last item in the list has an item_id value of The number of items in the list, not including the terminating null identifier, is returned in item_count. The caller is responsible for freeing the memory used by the list by calling The routine frees the memory used by an item list. The itemList operand is a list of items in an event generated by RETURN VALUE
The operation completed without error. One of the arguments to the function is invalid. A value in a structure member is invalid. An operation failed because an attempt to acquire heap memory failed. A request specified an item or variable name component in an itemList or a varList that is not part of the event being processed. ERRORS
The value of is not set. SEE ALSO
Commands evmshow(1). Routines EvmEventCreate(3), EvmEventDestroy(3), EvmEventFormat(3), EvmEventPost(3). Event Management EVM(5). EVM Events EvmEvent(5). EvmItemGet(3)
All times are GMT -4. The time now is 06:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy