Sponsored Content
Top Forums UNIX for Dummies Questions & Answers while loop not taking the not equal to condition Post 302223240 by ssuresh1999 on Friday 8th of August 2008 05:19:48 PM
Old 08-08-2008
I have another question related to my question posted yesterday

while [ "$engine_type" != "S" ] && [ "$engine_type" != "s" ] && [ "$engine_type" != "SR" ] && [ "$engine_type" != "sr" ] && [ "$engine_type" != "a" ] && [ "$engine_type" != "A" ]

is working fine
but how to short cut it say i mean the user can enter S or s A or a or Sr rS like that
writing everything in while makes it cumbersome
Is there any other way
Thanks in advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem taking input from file with for loop

I am trying to take input from a file and direct it into a bash script. This script is meant to be a foreach loop. I would like the script to process each item in the list one by one and direct the output to a file. # cat 1loop #!/bin/bash # this 2>&1 to redirect STDERR & STDOUT to file... (4 Replies)
Discussion started by: bash_in_my_head
4 Replies

2. Solaris

Infinite for loop is taking too much CPU usage %

Hi All, I wrote one simple for loop shell script which prints number..but this loop is infinite...but its taking lot of CPU (15.7) %. if i am using sleep cmd then cpu usage become 0.4 %. Is there anyway to reduce this CPU usage without using sleep cmd? i dont want 2 use sleep cmd... (7 Replies)
Discussion started by: pa.chidhambaram
7 Replies

3. Shell Programming and Scripting

For Loop Taking Too Long

I'm new from UNIX scripting. Please help. I have about 10,000 files from the $ROOTDIR/scp/inbox/string1 directory to compare with the 50 files from /$ROOTDIR/output/tma/pnt/bad/string1/ directory and it takes about 2 hours plus to complete the for loop. Is there a better way to re-write the... (5 Replies)
Discussion started by: hanie123
5 Replies

4. UNIX for Advanced & Expert Users

Comparison and For Loop Taking Too Long

I'd like to 1. Check and compare the 10,000 pnt files contains single record from the /$ROOTDIR/scp/inbox/string1 directory against 39 bad pnt files from the /$ROOTDIR/output/tma/pnt/bad/string1 directory based on the fam_id column value start at position 38 to 47 from the record below. Here is... (1 Reply)
Discussion started by: hanie123
1 Replies

5. Shell Programming and Scripting

if condition in a while loop

Gurus, I need to read a line from a file and strip the characters from it and compare the stripped value with the value I pass to the script while executing it. Below is the code for the same. But when i execute the code, it is throwing an error. #!/bin/ksh . /home/.i_env ... (14 Replies)
Discussion started by: svajhala
14 Replies

6. Shell Programming and Scripting

Use of -z in while loop condition

Hi, Could you please tell what is the meaning of -z in while loop condition. For example, while ; do echo "*** Enter the age " readage (3 Replies)
Discussion started by: vidyaj
3 Replies

7. Shell Programming and Scripting

If not equal to then loop

How do I go about amending this simple script that prompts for a yes/no response so that if neither Y or N are entered it will loop back back to the original prompt #!/bin/ksh echo "Enter yes of no" read answer if then echo "You selected yes" elif then echo "You selected no" elif... (5 Replies)
Discussion started by: gmears
5 Replies

8. Shell Programming and Scripting

grep not equal to condition

I have below files under dir_a and dir_b and i want to sort out number of dir_a and dir_b files seperately and if i do the grep it should retrun 2 files in dir_a and 1 file in dir_b. /dir_a/12345678 /dir_a/87654321 /dir_a/dir_b/12345687 But i am getting cat file|grep dir_a|wc -l 3... (6 Replies)
Discussion started by: prash358
6 Replies

9. Shell Programming and Scripting

While loop problem taking too long

while read myhosts do while read discovered do echo "$discovered" done < $LOGFILE | grep -Pi "|" | egrep... (7 Replies)
Discussion started by: SkySmart
7 Replies

10. Shell Programming and Scripting

Help with taking variable of for loop in textfile

Hi, I am new to unix/linux scripting. I have a text file, listlib.txt where the content: lib1_23 lib34_a ab_li_lab I need to generate a file (.log) of each cell. I am planning to create a (.csh) script that will have for loop with variable taken from listlib.txt. As for now, i have no... (4 Replies)
Discussion started by: mmaz
4 Replies
layout.h(3)							       log4c							       layout.h(3)

NAME
layout.h - Interface for user specific layout format of log4c_logging_event events. SYNOPSIS
#include <log4c/defs.h> #include <log4c/logging_event.h> #include <stdio.h> Data Structures struct log4c_layout_type log4c layout type class Defines #define log4c_layout_type_define(a_type) Typedefs typedef struct __log4c_layout log4c_layout_t typedef struct log4c_layout_type log4c_layout_type_t log4c layout type class Functions LOG4C_API const log4c_layout_type_t * log4c_layout_type_get (const char *a_name) LOG4C_API const log4c_layout_type_t * log4c_layout_type_set (const log4c_layout_type_t *a_type) LOG4C_API log4c_layout_t * log4c_layout_get (const char *a_name) LOG4C_API log4c_layout_t * log4c_layout_new (const char *a_name) LOG4C_API void log4c_layout_delete (log4c_layout_t *a_layout) LOG4C_API const char * log4c_layout_get_name (const log4c_layout_t *a_layout) LOG4C_API const log4c_layout_type_t * log4c_layout_get_type (const log4c_layout_t *a_layout) LOG4C_API const log4c_layout_type_t * log4c_layout_set_type (log4c_layout_t *a_layout, const log4c_layout_type_t *a_type) LOG4C_API void * log4c_layout_get_udata (const log4c_layout_t *a_layout) LOG4C_API void * log4c_layout_set_udata (log4c_layout_t *a_layout, void *a_udata) LOG4C_API const char * log4c_layout_format (const log4c_layout_t *a_layout, const log4c_logging_event_t *a_event) LOG4C_API void log4c_layout_print (const log4c_layout_t *a_layout, FILE *a_stream) LOG4C_API void log4c_layout_types_print (FILE *fp) Detailed Description Interface for user specific layout format of log4c_logging_event events. Todo the layout interface needs a better configuration system depending on the layout type. The udata field is a just a trick. Todo a pattern layout would be welcomed !! Define Documentation #define log4c_layout_type_define(a_type) Helper macro to define static layout types. Parameters: a_type the log4c_layout_type_t object to define Warning: needs GCC support: otherwise this macro does nothing Deprecated This macro, and the static initialialization of layouts in general, is deprecated. Use rather the log4c_layout_type_set() function to initialize your appenders before calling log4c_init() Typedef Documentation typedef struct __log4c_layout log4c_layout_t log4c layout class typedef struct log4c_layout_type log4c_layout_type_t log4c layout type class Attributes description: o name layout type name o format Function Documentation LOG4C_API void log4c_layout_delete (log4c_layout_t *a_layout) Destructor for layout. LOG4C_API const char* log4c_layout_format (const log4c_layout_t *a_layout, const log4c_logging_event_t *a_event) format a log4c_logging_event events to a string. Parameters: a_layout the log4c_layout_t object a_event a logging_event_t object Returns: an appendable string. LOG4C_API log4c_layout_t* log4c_layout_get (const char *a_name) Get a pointer to an existing layout. Parameters: a_name the name of the layout to return. Returns: a pointer to an existing layout, or NULL if no layout with the specfied name exists. LOG4C_API const char* log4c_layout_get_name (const log4c_layout_t *a_layout) Parameters: a_layout the log4c_layout_t object Returns: the layout name LOG4C_API const log4c_layout_type_t* log4c_layout_get_type (const log4c_layout_t *a_layout) Parameters: a_layout the log4c_layout_t object Returns: a log4c_layout_type_t object LOG4C_API void* log4c_layout_get_udata (const log4c_layout_t *a_layout) Parameters: a_layout the log4c_layout_t object Returns: the layout user data LOG4C_API log4c_layout_t* log4c_layout_new (const char *a_name) Constructor for layout. LOG4C_API void log4c_layout_print (const log4c_layout_t *a_layout, FILE *a_stream) prints the layout on a stream Parameters: a_layout the log4c_layout_t object a_stream the stream LOG4C_API const log4c_layout_type_t* log4c_layout_set_type (log4c_layout_t *a_layout, const log4c_layout_type_t *a_type) sets the layout type Parameters: a_layout the log4c_layout_t object a_type the new layout type Returns: the previous layout type LOG4C_API void* log4c_layout_set_udata (log4c_layout_t *a_layout, void *a_udata) sets the layout user data Parameters: a_layout the log4c_layout_t object a_udata the new layout user data Returns: the previous layout user data LOG4C_API const log4c_layout_type_t* log4c_layout_type_get (const char *a_name) Get a pointer to an existing layout type. Parameters: a_name the name of the layout type to return. Returns: a pointer to an existing layout type, or NULL if no layout type with the specified name exists. LOG4C_API const log4c_layout_type_t* log4c_layout_type_set (const log4c_layout_type_t *a_type) Use this function to register a layout type with log4c. Once this is done you may refer to this type by name both programatically and in the log4c configuration file. Parameters: a_type a pointer to the new layout type to set. Returns: a pointer to the previous layout type of same name. Example code fragment: const log4c_layout_type_t log4c_layout_type_xml = { 's13_xml', xml_format, }; log4c_layout_type_set(&log4c_layout_type_xml); LOG4C_API void log4c_layout_types_print (FILE *fp) prints all the current registered layout types on a stream Parameters: fp the stream Author Generated automatically by Doxygen for log4c from the source code. Version 1.2.1 Mon May 2 2011 layout.h(3)
All times are GMT -4. The time now is 10:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy