06-12-2009
special character validation except '-'
here i have a concern forgot to mention that user allowed to entered user id range like
0920920-902992 (valid)
92920-9292%^& ( invalid)
so i need to do special character validation which allows '-' and numerics only.
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am trying to think of a way to create user ids on multiple Linux systems in one fell swoop without logging onto each system indivually. Is there a way to do this with ssh commands? I don't want to use NIS/LDAP solution just a simple shell script utilitarian methodoloy would suffice. Also, I am... (1 Reply)
Discussion started by: darthur
1 Replies
2. Shell Programming and Scripting
Hello,
This may have been addressed already somewhere, however I am looking for the easiest/shortest way to validate a response from a user for a file name.
The file name should not have any of the following characters
~`!@#$%^&*()_-+={|\:;"'<,>.?/
Further the response should not have any... (2 Replies)
Discussion started by: jerardfjay
2 Replies
3. UNIX for Advanced & Expert Users
I'm kinda new to unix programming so bear with me...
I'm running a script prompting a user for an existing user and group and want to be able to validate if they valid.
Is there any code available?
Any help or push in the right direction would help.
Thank you, (2 Replies)
Discussion started by: thedon
2 Replies
4. Shell Programming and Scripting
Hi
Can you help me validate 2 variables?The first is an input date from the user and should be like this (yyyy-mm-dd). The second variable is an input time from the user and should be like this(hh:mm).When the input is wrong i want to give the chance to the user to insert again the date or time... (8 Replies)
Discussion started by: DDoS
8 Replies
5. UNIX for Dummies Questions & Answers
Hey, im trying to validate a user input and need some help. The input needs to be just a single letter. Im using a case to so this eg:
read answer
case $answer in
*) echo "OK"
;;
*) echo "This is a number"
read answer
;;
*) echo... (2 Replies)
Discussion started by: 602chrislys
2 Replies
6. UNIX for Dummies Questions & Answers
Hello all:
Working on a job I was asked get a simple script to perform the following task and would like to ask for some help. I'm looking forward to learning more and diving deeper into the World of Open Source servers.
I need a script for a Unix server, using as few lines as possible, that... (4 Replies)
Discussion started by: moahten
4 Replies
7. Shell Programming and Scripting
I'm trying to only read price (FLOAT (i.e 1.10, 3.14, etc etc))
If the input is just an integer, I will add a .00 behind. (i.e 3 becomes 3.00 , 20 becomes 20.00)
If the input is without 2 decimal places, I'll add a 0. (i.e 3.1 becomes 3.10)
I tried using the below code, it works but I don't... (6 Replies)
Discussion started by: andylbh
6 Replies
8. Shell Programming and Scripting
$Input_filename=$ARGV;
if (!-d $Input_filename && ! -e $Input_filename)
{
print "USAGE: Please enter '$ABCD/def/dsed.txt' as an arguement \n";
exit;
}
1. Input Is suppose to be something like "$ABCD/def/dsed.txt".
if the input is wrong the script should throw an ERROR message.... (2 Replies)
Discussion started by: Rashid Khan
2 Replies
9. AIX
if I want to create a bundle of user ids on some aix servers, if there is a way not need to do "passwd username" one by one user to set the password?
Thanks (3 Replies)
Discussion started by: rainbow_bean
3 Replies
LEARN ABOUT REDHAT
set_fieldtype_arg
form_fieldtype(3X) form_fieldtype(3X)
NAME
form_fieldtype - define validation-field types
SYNOPSIS
#include <form.h>
FIELDTYPE *new_fieldtype(
bool (* const field_check)(FIELD *, const void *),
bool (* const char_check)(int, const void *));
int free_fieldtype(FIELDTYPE *fieldtype);
int set_fieldtype_arg(
FIELDTYPE *fieldtype,
void *(* const make_arg)(va_list *),
void *(* const copy_arg)(const void *),
void (* const free_arg)(void *));
int set_fieldtype_choice(
FIELDTYPE *fieldtype,
bool (* const next_choice)(FIELD *, const void *),
bool (* const prev_choice)(FIELD *, const void *));
FIELDTYPE *link_fieldtype(FIELDTYPE *type1,
FIELDTYPE *type2);
DESCRIPTION
The function new_fieldtype creates a new field type usable for data validation. You supply it with field_check, a predicate to check the
validity of an entered data string whenever the user attempt to leave a field. The (FIELD *) argument is passed in so the validation pred-
icate can see the field's buffer, sizes and other attributes; the second argument is an argument-block structure, about which more below.
You also supply new_fieldtype with char_check, a function to validate input characters as they are entered; it will be passed the character
to be checked and a pointer to an argument-block structure.
The function free_fieldtype frees the space allocated for a given validation type.
The function set_fieldtype_arg associates three storage-management functions with a field type. The make_arg function is automatically
applied to the list of arguments you give set_field_type when attaching validation to a field; its job is to bundle these into an allocated
argument-block object which can later be passed to validation predicated. The other two hook arguments should copy and free argument-block
structures. They will be used by the forms-driver code. You must supply the make_arg function, the other two are optional, you may supply
NULL for them. In this case it is assumed that make_arg does not allocate memory but simply loads the argument into a single scalar value.
The form driver requests REQ_NEXT_CHOICE and REQ_PREV_CHOICE assume that the possible values of a field form an ordered set, and provide
the forms user with a way to move through the set. The set_fieldtype_choice function allows forms programmers to define successor and pre-
decessor functions for the field type. These functions take the field pointer and an argument-block structure as arguments.
RETURN VALUE
The pointer-valued routines return NULL on error.
The integer-valued routines return one of the following codes on error:
E_OK The routine succeeded.
E_SYSTEM_ERROR
System error occurred (see errno).
E_BAD_ARGUMENT
Routine detected an incorrect or out-of-range argument.
E_CONNECTED
The field is already connected to a form.
SEE ALSO
curses(3X), form(3X).
NOTES
The header file <form.h> automatically includes the header file <curses.h>.
All of the (char *) arguments of these functions should actually be (void *). The type has been left uncorrected for strict compatibility
with System V.
PORTABILITY
These routines emulate the System V forms library. They were not supported on Version 7 or BSD versions.
AUTHORS
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond.
form_fieldtype(3X)