02-25-2013
How-To Check & Filter user input
Hi,
On my Java webpage which invokes the shell script has two checkboxes viz ...
apache
and
weblogic
apache require one parameter i.e apache home from the user while Weblogic requires three or five params from the user vi.z weblogic_home or <jdk_home, config_home & pid>, username and password.
The use may choose to select any one product or both(apache and weblogic)
Thus the possible user inputs can be
1. selecting either apache or weblogic or both.
2. if apache is selected then one paramter must be passed
3. if weblogic is selected either 3 or 5 paramters should be passed to the script
Anything more or less that the user inputs should terminate the script with exception message.
Please let me know how could it be implemented ?
Last edited by mohtashims; 02-25-2013 at 08:47 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi,
am a new learner to shell programming.
i have a script which will prompt for user to key in their name & display their name afterwards.
script
=====
echo "Pls enter your name:"
read name
echo "Your name is $name."
output
=====
Pls enter your name:
Bob
Your name is Bob.
what... (2 Replies)
Discussion started by: newbie168
2 Replies
2. Shell Programming and Scripting
Bash : how do i check the user input and make sure is only character or only number ? (7 Replies)
Discussion started by: CheeSen
7 Replies
3. Shell Programming and Scripting
Hello All,
I am stuck with the follwing problem , pls give me some advice..
Input file:
input clock;
input reset; \\reset all
input yuv;
//input comment
output sur;
output sud;
output vtua;
output tur;
input ebi;
//output comment
The input file... (1 Reply)
Discussion started by: user_prady
1 Replies
4. UNIX for Dummies Questions & Answers
Hello everybody!!!
I am writing my own rm command in unix.
I prompt the user to type if he wants to delete a file and then read what he typed.
But how do i check what he typed?
This is my program so far:
echo 'Delete prog1.c (y/n)?'
read yesOrNo
if yesOrNo == 'y'
then
rm prog1.c... (6 Replies)
Discussion started by: mskart
6 Replies
5. Shell Programming and Scripting
Trying to create a script/executable to replace "abc" text string in "myfile.htm" with input from a pop-up field. For example, launch this thing and a prompt is popped up asking the user to input what "abc" should be replaced with, then it inserts what the user inputs in place of abc in the... (3 Replies)
Discussion started by: mike909
3 Replies
6. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
(o) Checkout an auto part: should prompt the user for the name of the auto part
and borrower's name:
Name:... (2 Replies)
Discussion started by: SlapnutsGT
2 Replies
7. Homework & Coursework Questions
Good Evening. I'm new to C. Can you please help me.
I'm creating an error checking function, user will input a string, this will check if the input is all alphabet or all letters only. If there is a digit or other special char, it will print Error then ask input from user again.
Here's my... (1 Reply)
Discussion started by: eracav
1 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. Shell Programming and Scripting
How to check the user input to be valid using shell script?
The valid input is in the format like as follows.
1. It can only have r,w,x or a hyphen and nothing else.
2. ensure the r, w, x are in the correct order.
for example: rwxr-xr-x is a valid format.
Thanks (5 Replies)
Discussion started by: hyeewang
5 Replies
10. Shell Programming and Scripting
Hi All,
#!/bin/bash
#Just trying to check if letters are in the user input. Any tips?
# I have tried regexp and using 0-9 etc, i cannot get this to work either in just an if statement or while in a loop.
echo "Please pick a number"
read num
if ; then
echo "Please enter a number"... (7 Replies)
Discussion started by: jvezinat
7 Replies
LEARN ABOUT DEBIAN
apache2::sitecontrol::user
Apache2::SiteControl::User(3pm) User Contributed Perl Documentation Apache2::SiteControl::User(3pm)
NAME
Apache2::SiteControl::User - User representations
SYNOPSIS
my $user = Apache2::SiteControl->getCurrentUser($r);
# $r is the apache request object
# Checking out the user's name:
if($user->getUsername eq 'sam') { ... }
...
# Working with attributes (session persistent data)
my $ssn = $user->getAttribute('ssn');
$user->setAttribute($r, 'ssn', '333-555-6666');
# Removing/invalidating session for the user
$user->logout($r);
DESCRIPTION
The SiteControl system has a base concept of a user which includes the user's name, persistent attributes (which are persistent via
session), and support for user logout.
It is assumed that you will be working from mod_perl, and some of the methods require an Apache request object. The request object is used
by some methods to coordinate access to the actual session information in the underlying system (for storing attributes and implementing
logout).
User objects are created by a factory (by default Apache2::SiteControl::UserFactory), so if you subclass User, you must understand the
complete interaction between the factory (which is responsible for interfacing with persistence), the SiteControl, etc.
The default implementation of User and UserFactory use AuthCookie to manage the sessions, and Apache::Session::File to store the various
details about a user to disk.
If you are using Apache2::SiteControl::User and Apache::SiteControl::UserFactory (the default and recommended), then you should configure
the following parameters in your apache configuration file:
# This is where the session data files will be stored
SiteControlSessions directory_name
# This is where the locks will be stored
SiteControlLocks directory_name
These two directories should be different, and should be readable and writable by the apache daemon only. They must exist before trying to
use SiteControl.
METHODS
getUsername Get the name that the current user used to log in.
getAttribute($name) Get the value of a previously stored attribute. Returns undef is there is no value.
setAttribute($request, $name, $value) Add an attribute (scalar data only) to the current session. The current apache request object is
required (in order to figure out the session). Future versions may support more complex storage in the session. This attribute will stay
associated with this user until they log out.
logout($request) Log the user out. If you do not pass the current apache request, then this method will log an error to the apache error
logs, and the user's session will continue to exist.
SEE ALSO
Apache2::SiteControl::UserFactory, Apache::SiteControl::ManagerFactory, Apache2::SiteControl::PermissionManager, Apache::SiteControl
AUTHOR
This module was written by Tony Kay, <tkay@uoregon.edu>.
COPYRIGHT AND LICENSE
This modules is covered by the GNU public license.
perl v5.14.2 2006-03-17 Apache2::SiteControl::User(3pm)