10-01-2014
Bash script to give multiple choices and a varying number of answers
Hello everybody,
I use `case' quite a lot but , excellent as it is , it only gives one
final result ; can anyone suggest a way whereas , say long
lists of choices are given and I , or a user could select either one
two or any number of results to be echoed .
many thanks in anticipation
v686.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a situation where I am reading a text file line-by-line. Those lines of data contain comma separated fields of data. However, each line can vary in the number of fields it can contain. What I need to do is parse apart each line and write each field of data found (left to right) into a file.... (7 Replies)
Discussion started by: 2reperry
7 Replies
2. Shell Programming and Scripting
I've created an awk script that handles a varying number of search strings handed to it as command line parameters ($1 $2 etc). There may be 1, or 2 or 3 or more. A simplified version of the script is:
awk -v TYP="$1 $2 $3 $4 $5 $6" '
BEGIN {
CTYP = split (TYP,TYPP," ")
}
... (2 Replies)
Discussion started by: CarlosNC
2 Replies
3. Solaris
I was not able to get answers for these interview questions. It will be appreciable and useful if any one answers this questions. (5 Replies)
Discussion started by: Sesha
5 Replies
4. Shell Programming and Scripting
Hi Folks,
I am trying to make a script to assign all diskspace to slice 0, on multiple sized disks. Since the disks are new they may need to be labelled also to avoid the error: Cannot get disk geometry
Below is my code struggling with logic which doesn't seem to be producing the desired... (0 Replies)
Discussion started by: momin
0 Replies
5. Shell Programming and Scripting
Hi All,
My file has the records as below:
aaa\bbb\c\dd\ee\ff\gg
zz\vv\ww
pp\oo\ii\uu
How can I get the value after the last delimeter.
My o/p:
gg
ww
uu
Thanks in Advance, (5 Replies)
Discussion started by: HemaV
5 Replies
6. UNIX for Dummies Questions & Answers
Got struck while trying to write a shell script which should automatically give input.
While running a script for eg: (adpatch.sh)
It Prompts for Multiple inputs like:
Do you currently have files used for installing or upgrading the database
installed in this APPL_TOP ? need to give... (2 Replies)
Discussion started by: abdmoha
2 Replies
7. Shell Programming and Scripting
Hi Guy's.
Hopefully someone can help me with what I am trying to archieve.
So situation currently is, I have a script already setup however I have another script that sits infront of it.
The main script basically goes and searchs multiple platforms for a list of entered data.
In... (10 Replies)
Discussion started by: mutley2202
10 Replies
8. Shell Programming and Scripting
Hi,
I am new in perl.
I am running a perl installation script, its asking for paths and so many inputs.
Can we provide that info by any file.
so i can avoid the interactive installation. (2 Replies)
Discussion started by: Priy
2 Replies
9. Shell Programming and Scripting
Hi,
I want a script which search for a pattern "good" in a huge file and provide me number of occurences of such pattern in a file.
lets say i have a file test.txt contents as below
good is good
but good is sometime bad and sometime good
you are very good and good is always good
... (7 Replies)
Discussion started by: sv0081493
7 Replies
10. Shell Programming and Scripting
I have a text file in this format
Some lines....
Question no: 1
The question?
A. Answer 1
B. Answer 2
C. Answer 3
D. Answer 4
Answer:B
Some lines....
Question no: 2
The question? (choose 2) (10 Replies)
Discussion started by: zorrox
10 Replies
LEARN ABOUT REDHAT
ldap_result
LDAP_RESULT(3) Library Functions Manual LDAP_RESULT(3)
NAME
ldap_result - Wait for the result of an LDAP operation
SYNOPSIS
#include <ldap.h>
int ldap_result(ld, msgid, all, timeout, result)
LDAP *ld;
int msgid, all;
struct timeval *timeout;
LDAPMessage **result;
int ldap_msgfree(msg)
LDAPMessage *msg;
int ldap_msgtype(msg)
LDAPMessage *msg;
int ldap_msgid(msg)
LDAPMessage *msg;
DESCRIPTION
The ldap_result() routine is used to wait for and return the result of an operation previously initiated by one of the LDAP asynchronous
operation routines (e.g., ldap_search(3), ldap_modify(3), etc.). Those routines all return -1 in case of error, and an invocation identi-
fier upon successful initiation of the operation. The invocation identifier is picked by the library and is guaranteed to be unique across
the LDAP session. It can be used to request the result of a specific operation from ldap_result() through the msgid parameter.
The ldap_result() routine will block or not, depending upon the setting of the timeout parameter. If timeout is not a NULL pointer, it
specifies a maximum interval to wait for the selection to complete. If timeout is a NULL pointer, the select blocks indefinitely.
To effect a poll, the timeout argument should be a non-NULL pointer, pointing to a zero-valued timeval structure. See select(2) for
further details.
If the result of a specific operation is required, msgid should be set to the invocation identifier returned when the operation was initi-
ated, otherwise LDAP_RES_ANY should be supplied. The all parameter only has meaning for search responses and is used to select whether a
single entry of the search response should be returned, or all results of the search should be returned.
A search response is made up of zero or more search entries followed by a search result. If all is set to 0, search entries will be
returned one at a time as they come in, via separate calls to ldap_result(). If it's set to 1, the search response will only be returned
in its entirety, i.e., after all entries and the final search result have been received.
Upon success, the type of the result received is returned and the result parameter will contain the result of the operation. This result
should be passed to the LDAP parsing routines, ldap_first_entry(3) and friends, for interpretation.
The possible result types returned are:
#define LDAP_RES_BIND 0x61L
#define LDAP_RES_SEARCH_ENTRY 0x64L
#define LDAP_RES_SEARCH_RESULT 0x65L
#define LDAP_RES_MODIFY 0x67L
#define LDAP_RES_ADD 0x69L
#define LDAP_RES_DELETE 0x6bL
#define LDAP_RES_MODRDN 0x6dL
#define LDAP_RES_COMPARE 0x6fL
The ldap_msgfree() routine is used to free the memory allocated for a result by ldap_result() or ldap_search_s(3) and friends. It takes a
pointer to the result to be freed and returns the type of the message it freed.
The ldap_msgtype() routine returns the type of a message.
The ldap_msgid() routine returns the message id of a message.
ERRORS
ldap_result() returns -1 if something bad happens, and zero if the timeout specified was exceeded. ldap_msgtype() and ldap_msgid() return
-1 on error.
NOTES
This routine dynamically allocates memory for results that it receives. The memory can be freed by the caller using ldap_msgfree.
SEE ALSO
ldap(3), ldap_search(3), select(2)
ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project (http://www.openldap.org/). OpenLDAP is derived from University of Michigan
LDAP 3.3 Release.
OpenLDAP 2.0.27-Release 22 September 1998 LDAP_RESULT(3)