01-18-2014
Quote:
Originally Posted by
mohamed91
i'm using UNIX solaries ksh
[...]
it always see the input write .. for example if u give a alpha to numeric field ,it accept it !
OK, this explains at least some of the missing parts. You still haven't said which data types you expect and how they look like. In fact this is the first thing you should do: ask yourself what a "datatype" is and what it looks like. Write down the rules for the data types you want to check.
For instance, mentioned "numeric", but: will this be an integer (no commas) or a floating point value (can contain commas), will it be unsigned (no negative values) or signed (negative and positive values possible), will it have certain ranges, which are allowed (for instance, 8bit so-called "short short int" can hold values 0-255 when unsigned, 0- +/-127 when signed)
Then, there might be "intrinsic rules": if you enter a name (basically a string) you might want to allow "-" but not characters like "&", "%", etc.. Further, a rule might be that the first letter in each word has to be uppercase, all others lowercase (because "John Doe" is correct, "JOhn dOE" is not). Your type-checker should reflect that.
I hope this helps.
bakunin
This User Gave Thanks to bakunin For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All
Can anyone let me have a easy way to test if no input was given to a standard read. I would think of using the lenght of the variable, however this seems to be a long cut.
Thx
J (8 Replies)
Discussion started by: jhansrod
8 Replies
2. UNIX for Dummies Questions & Answers
What script can I use to catch errors in a shell script if user inputs alpha numeric characters instead on integers from the keyboard? (0 Replies)
Discussion started by: Pauline mugisha
0 Replies
3. Shell Programming and Scripting
There are times where I want to use putty(vt100 TERM) and hummingbird (XTERM) is there a way to test what terminal connection I am using in my .profile so I can set my commands like stty erase correctly. (4 Replies)
Discussion started by: BeefStu
4 Replies
4. HP-UX
Hi,
I'm trying to download a compatible Oracle Client software for a HP-UX machine. I'd like to know if ...
1) HP-UX is 32 bit or 64 bit?
2) Processor type - Itanium or regular?
when I execute uname -a I get
HP-UX B.11.11 U 9000/800 728684161 unlimited-user license
Based on the... (7 Replies)
Discussion started by: luft
7 Replies
5. Shell Programming and Scripting
Ok, I have a script with a commandline option that allows the user to add a custom function to the script file. I have tried everything in my limited knowledge of sed to get this to work and keep coming up short. I need sed to search for a line starting with a pattern, I've got that part so far,... (0 Replies)
Discussion started by: DC Slick
0 Replies
6. Shell Programming and Scripting
I want a script that will add comments to a file before check-in files. comments depend on type of files.
i have a script to list files in the directory that will be checked-in
There are xml, js, html, vm files. vm will use comments like c/c++ ( // or /*..*/)
can you help me add a comment line... (0 Replies)
Discussion started by: pradeepmacha
0 Replies
7. Shell Programming and Scripting
Hi,
echo "Enter file name of input file list along with absolute path : "
read inputFileList
if
then
for string in `cat inputFileList`
do
echo $string
done
else
echo " file does not exist"
fi
From the above code, if the user enters a invalid file... (1 Reply)
Discussion started by: i.srini89
1 Replies
8. Shell Programming and Scripting
Hi,
can some one help me how to encrypt and decrypt a file.
AIM: reade user input, encrypt it and save it to file.
while decryption read the encrypted file decrypt it and save the output in some variable.
Example: consider we have Credentials.txt file with content username: password... (5 Replies)
Discussion started by: saichand1985
5 Replies
9. Shell Programming and Scripting
I am trying to allow a user to enter in text and then store that text in a variable $gene to run in an awk command in which those values are used to run some calculations. I am getting syntax errors however, when I try. Thank you :).
The awk runs great if it is a pre-defined file that is used,... (7 Replies)
Discussion started by: cmccabe
7 Replies
10. Shell Programming and Scripting
Hello,
I am running under ubuntu1 14.04 and I have a script which is sending given process names to vanish so that I'd see less output when I run most popular tools like top etc in terminal window. In usual method it works.
Whenever I restart the system, I have to enter the same data from... (2 Replies)
Discussion started by: baris35
2 Replies
LEARN ABOUT OPENDARWIN
chsh
CHSH(1) User Commands CHSH(1)
NAME
chsh - change login shell
SYNOPSIS
chsh [options] [LOGIN]
DESCRIPTION
The chsh command changes the user login shell. This determines the name of the user's initial login command. A normal user may only change
the login shell for her own account; the superuser may change the login shell for any account.
OPTIONS
The options which apply to the chsh command are:
-h, --help
Display help message and exit.
-R, --root CHROOT_DIR
Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory.
-s, --shell SHELL
The name of the user's new login shell. Setting this field to blank causes the system to select the default login shell.
If the -s option is not selected, chsh operates in an interactive fashion, prompting the user with the current login shell. Enter the new
value to change the shell, or leave the line blank to use the current one. The current shell is displayed between a pair of [ ] marks.
NOTE
The only restriction placed on the login shell is that the command name must be listed in /etc/shells, unless the invoker is the superuser,
and then any value may be added. An account with a restricted login shell may not change her login shell. For this reason, placing /bin/rsh
in /etc/shells is discouraged since accidentally changing to a restricted shell would prevent the user from ever changing her login shell
back to its original value.
FILES
/etc/passwd
User account information.
/etc/shells
List of valid login shells.
/etc/login.defs
Shadow password suite configuration.
SEE ALSO
chfn(1), login.defs(5), passwd(5).
shadow-utils 4.5 01/25/2018 CHSH(1)