03-04-2008
check the input
how to check whether a given input is a number or a string?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
What can i do to check that the input is all alphabet.. ? (4 Replies)
Discussion started by: XXXXXXXXXX
4 Replies
2. Shell Programming and Scripting
HI all,
I would like to know how the user can be restricted for entering only the number and not characters in sheel scripts..
Suppose code is like this
echo 'Enter the number'
read Value
Now user may enter 'a' as value...
But i want to disallow him for entering characters other than... (3 Replies)
Discussion started by: dhananjaysk
3 Replies
3. Shell Programming and Scripting
All,
I have a requirement to write a script where I check for Input redirection when the script was executed, based on which I handle my logic. Below is the example:
my.script
#! /bin/ksh
# Not sure how to frame the if condition below
if ; then
echo "Input Redirected from a file"
... (7 Replies)
Discussion started by: bharath.gct
7 Replies
4. Programming
Suppose we have a simple situation, like the following C++ instructions:
int x;
cout << "Insert x: ";
cin >> x;
while ( x-- < 0 ) ;
Of course, if it is written something different from an integer, the while loop shall not end.
So, how can we check if the input x is of the right type? (2 Replies)
Discussion started by: Luke Bonham
2 Replies
5. Shell Programming and Scripting
Hi all
i need to check that if user has passed any input parameter while executing he shell script like
./test1.sh -a"-v"
then do smothing
if user execute the script without giving input paramater then
./test1.sh
then do something
how can we check this input parameter (6 Replies)
Discussion started by: aishsimplesweet
6 Replies
6. Shell Programming and Scripting
Hi,
I have a script which runs daily. It gets 3 input files test1,test2,test3. I want to do a validation in my script to make sure i have all the 3 files available before running. If any one of the file is missing i want to break the script.
Could you please help me with this request.
... (1 Reply)
Discussion started by: Krrishv
1 Replies
7. Shell Programming and Scripting
Hi Guys
I have a Requirement that the input will be given and i have to check whether the input is a Year or not.
For Example
2004,2009 and so on forth will be considered a year and anything else like
12:15 or else will not be.
Have built the below Code
set -x
echo " Enter... (6 Replies)
Discussion started by: Ajesh
6 Replies
8. Shell Programming and Scripting
Hi,
I need my script to check if the user enters 3 values if not 5 values to my script and alert if the input has any other number of values.
for example:
./myscript.sh 22 56 3221 - > correct
./myscript.sh 22 56 3221 45 777 -> correct
./myscript.sh 22 56 3221 45 -> incorrect
Please... (6 Replies)
Discussion started by: mohtashims
6 Replies
9. UNIX for Dummies Questions & Answers
I have a file which extracts data from an HTML file
For Eg HTML file contains:
New York;ABC;145;Yes;YES;No
New York;BCD;113;Yes;YES;No
New York;NAS;63;Yes;YES;No
------------------------
London-48;CBT;16;Yes;YES;No
London-48;CME;17;Yes;YES;No
London-48;EUR;52;Yes;YES;No... (7 Replies)
Discussion started by: newkid.7955
7 Replies
10. Shell Programming and Scripting
Hello there, find below for my code first:
$pdp_asaba=`cat /tmp/temp_total | grep asaba | sed 's/*//g'`
if ]]
then pdp_asaba=0
fi
$pdp_abuja=`cat /tmp/temp_total | grep abuja | sed 's/*//g'`
if ]]
then pdp_abuja=0
fi
$pdp_ojota=`cat /tmp/temp_total | grep ojota | sed 's/*//g'`
if ... (3 Replies)
Discussion started by: infinitydon
3 Replies
LEARN ABOUT HPUX
xwclookupstring
XwcLookupString() XwcLookupString()
Name
XwcLookupString - obtain composed wide-character input from an input method.
Synopsis
int XwcLookupString(ic, event, buffer_return, bytes_buffer,
keysym_return, status_return)
XIC ic;
XKeyPressedEvent *event;
wchar_t *buffer_return;
int wchars_buffer;
KeySym *keysym_return;
Status *status_return;
Arguments
ic Specifies the input context.
event Specifies the keypress event to be used.
buffer_return
Returns a wide-character string (if any) from the input method.
wchars_buffer
Specifies the number of wide-characters in return buffer.
keysym_return
Returns the KeySym computed from the event if this argument is not NULL.
status_return
Returns a value indicating what kind of data is returned.
Returns
The length, in wide characters, of the string returned in buffer_return, if any.
Availability
Release 5 and later.
Description
XwcLookupString() passes a KeyPress event to an input context, returns composed text in the encoding of the locale of the input context if
any is ready, and may return a keysym corresponding to the KeyPress event as well.
There are several possible results of a call to XwcLookupString(), and a client should check the value returned in the status_return argu-
ment to determine which has occured. The possible values are:
XBufferOverflow
The input string to be returned is too large for the supplied buffer_return. The required size in wide characters is returned as
the value of the function, and the contents of buffer_return and keysym_return are not modified. The client should re-call the
function with the same event and a buffer of adequate size in order to obtain the string.
XLookupNone
No consistent input has been composed so far. The contents of buffer_return and keysym_return are not modified, and the function
returns zero.
XLookupChars
Some input characters have been composed. They are placed in the buffer_return argument, and the string length in wide
characters is returned as the value of the function. The string is encoded in the locale bound to the input context. The
contents of the keysym_return argument is not modified.
XLookupKeySym
A KeySym has been returned instead of a string and is returned in keysym_return. The contents of the buffer_return argument is
not modified, and the function returns zero.
XLookupBoth
Both a KeySym and a string are returned; XLookupChars and XLookupKeySym occur simultaneously.
When XwcLookupString() returns a string, the return value of the function is the length, in wide characters, of that string. The returned
string is a wide-character string in the encoding of the locale of the input context. If that encoding is state-dependent, the string
begins in the initial state of the encoding.
When both a keysym and a string are returned, the string does not necessarily correspond to the keysym. An application that is not inter-
ested in return keysyms can pass a NULL keysym_return
Note that only KeyPress events should be passed to XwcLookupString(). When KeyRelease events are passed, the resulting behavior is unde-
fined. It does not make any difference if the input context passed as an argument to XmbLookupString() and XwcLookupString() is the one
currently in possession of the focus or not. Input may have been composed within an input context before it lost the focus, and that input
may be returned on subsequent calls to XmbLookupString() or XwcLookupString(), even though it no longer has any more keyboard focus.
See Also
XLookupKeysym(), XmbLookupString().
Xlib - Internationalized Text Input XwcLookupString()