What if something else is entered, i.e. not a number? Consider also a wildcard option for your case statement:-
I thinks that select is working as designed. It is simple enough and work, but not that flexible, however I am very happy to use it. Perhaps you could allow any input and then work on the choice outside of the select loop, just calling it to display your menu.
I have a file containing a list of references and I want to run a script that will make the same action for each reference.
The input file changes every hour, it's why I want to use a script that can read in a file, record by record, and run a specific action for the reference readed.
Thanks... (1 Reply)
Hello everyone,
I have a quick question about the select command in ksh. I am using it to define a menu for user selection, I have found that the REPLY var contains the input from the user, I was interested to find out if there is a system variable that contains the whole menu as an array, the... (2 Replies)
Trying to create a script in BASH that would ask the user to enter another user name making sure the input is not blank before they hit enter then to check the home directory of that user does exist, I have the check folder sorted it's just the loop to make sure the user has entered chars (5 Replies)
Hey,
examples of the input (text line):
/bla/blMOasdn234.adanif24/blabla.rar
/bla/blMOasdn234.adanif24/blabla23124.bin
/bla/bla/bla/bla/bla/bla.bin
and what I need to do is extract/select only the dir path so the output would be:
/bla/blMOasdn234.adanif24/
/bla/blMOasdn234.adanif24/... (4 Replies)
Okay -- I hope I ask this correctly.
I'm working on my little shell script to write vendor names and aliases to files from user input. If a user choose to add to a file, he can do that as well. I'm using a select loop for this function to list all the possible files the user can choose from.... (7 Replies)
Hi All
I am using the below code to chose a file to view :
PS3="Select file to view : "
select FILE in `ls` QUIT
do
if ; then
clear
cat $FILE
else
break
fi
REPLY=''
done
Everything works fine as long as I am giving the correct choice .
But when i give a... (4 Replies)
Hello everyone,
A simple question which may have a suggested solution:
I am using, and loving, the select command in a ksh93 script on AIX 6.1 to present users with menus.
I have been successful in controlling all of key input by the users, I still have an issue with the RETURN key. When the... (4 Replies)
Hi Folks,
I have the below feed file named abc1.txt in which you can see there is a title and below is the respective values in the rows and it is completely pipe delimited file ,.
... (3 Replies)
A lot of my scripting makes use of the 'select' command to create menu driven input. A typical example of how I use it is as:
somevar=''
PS3='Select one: '
while ]; do
select somevar in $(sqlplus -s $dbuser/$dbpw@mydb <<EOF
set echo off feedback off verify off... (7 Replies)
Hi
I'm using the "select" command in the global_env.sh to log in to the application directory. This file is called in .bashrc profile.
Sample code:
Filename: global_env.sh
set -o vi
export severname=$(uname -n)
printf '%s\n%30s\n%s\n' "***********************" "Welcome to $severname"... (6 Replies)
Discussion started by: cheers799
6 Replies
LEARN ABOUT CENTOS
pcap_get_selectable_fd
PCAP_GET_SELECTABLE_FD(3PCAP)PCAP_GET_SELECTABLE_FD(3PCAP)NAME
pcap_get_selectable_fd - get a file descriptor on which a select() can be done for a live capture
SYNOPSIS
#include <pcap/pcap.h>
int pcap_get_selectable_fd(pcap_t *p);
DESCRIPTION
pcap_get_selectable_fd() returns, on UNIX, a file descriptor number for a file descriptor on which one can do a select() or poll() to wait
for it to be possible to read packets without blocking, if such a descriptor exists, or -1, if no such descriptor exists. Some network
devices opened with pcap_create() and pcap_activate(), or with pcap_open_live(), do not support select() or poll() (for example, regular
network devices on FreeBSD 4.3 and 4.4, and Endace DAG devices), so -1 is returned for those devices.
Note that in:
FreeBSD prior to FreeBSD 4.6;
NetBSD prior to NetBSD 3.0;
OpenBSD prior to OpenBSD 2.4;
Mac OS X prior to Mac OS X 10.7;
select() and poll() do not work correctly on BPF devices; pcap_get_selectable_fd() will return a file descriptor on most of those versions
(the exceptions being FreeBSD 4.3 and 4.4), but a simple select() or poll() will not indicate that the descriptor is readable until a full
buffer's worth of packets is received, even if the read timeout expires before then. To work around this, an application that uses
select() or poll() to wait for packets to arrive must put the pcap_t in non-blocking mode, and must arrange that the select() or poll()
have a timeout less than or equal to the read timeout, and must try to read packets after that timeout expires, regardless of whether
select() or poll() indicated that the file descriptor for the pcap_t is ready to be read or not. (That workaround will not work in FreeBSD
4.3 and later; however, in FreeBSD 4.6 and later, select() and poll() work correctly on BPF devices, so the workaround isn't necessary,
although it does no harm.)
Note also that poll() doesn't work on character special files, including BPF devices, in Mac OS X 10.4 and 10.5, so, while select() can be
used on the descriptor returned by pcap_get_selectable_fd(), poll() cannot be used on it those versions of Mac OS X. Kqueues also don't
work on that descriptor. poll(), but not kqueues, work on that descriptor in Mac OS X releases prior to 10.4; poll() and kqueues work on
that descriptor in Mac OS X 10.6 and later.
pcap_get_selectable_fd() is not available on Windows.
RETURN VALUE
A selectable file descriptor is returned if one exists; otherwise, -1 is returned.
SEE ALSO pcap(3PCAP), select(2), poll(2)
5 April 2008 PCAP_GET_SELECTABLE_FD(3PCAP)