Sponsored Content
Top Forums Shell Programming and Scripting [Solved] Testing Data Type of User Input Post 302884234 by bakunin on Saturday 18th of January 2014 07:49:00 PM
Old 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

Testing for no input.

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

Testing for correct user input from keyboard

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

Testing for TERM type

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

[Solved] processor type and bit information

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

Append file based upon user input-- solved

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

write to multiple files depending on file type (solved)

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

How to get the user input recursively until the user provides valid input

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

Read user input, Encrypt the data and write to file

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

User input and run awk using the input

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

How to embed data instead of reading user input from an array?

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
MINCEXTRACT(1)							 MINC User's Guide						    MINCEXTRACT(1)

NAME
mincextract - dump a hyperslab of MINC file data SYNOPSIS
mincextract [options] mincfile DESCRIPTION
mincextract dumps a chunk of MINC file data to standard output in the format of your choice. OPTIONS
-ascii Write out data as ascii strings (default) -byte Write out data as 8-bit integers -short Write out data as 16-bit integers -int Write out data as 32-bit integers -long Superseded by -int -float Write out data as single precision floating-point values -double Write out data as double precision floating-point values -filetype Write out data in the type of the file -signed Write out signed data (applies only to integer types) -unsigned Write out unsigned data (applies only to integer types) -range low high Specify the range of output values -normalize Normalize integer pixel values to file max and min (Default) -nonormalize Turn off pixel normalization -image_range low high Specify the range of real image values for normalization -image_minimum min Specify the minimum real image value for normalization -image_maximum max Specify the maximum real image value for normalization -start indexvector Specifies corner of hyperslab (C conventions for indices). Indices are either separated by spaces (enclosed by quotes) or commas (no quotes required). -count indexvector Specifies edge lengths of hyperslab to read. Indices are either separated by spaces (enclosed by quotes) or commas (no quotes required). -positive_direction Flip images to always have positive direction. -negative_direction Flip images to always have negative direction. -any_direction Do not flip images (Default). +xdirection Flip images to give positive xspace:step value (left-to-right). -xdirection Flip images to give negative xspace:step value (right-to-left). -xanydirection Don't flip images along x-axis (default). +ydirection Flip images to give positive yspace:step value (post-to-ant). -ydirection Flip images to give negative yspace:step value (ant-to-post). -yanydirection Don't flip images along y-axis (default). +zdirection Flip images to give positive zspace:step value (inf-to-sup). -zdirection Flip images to give negative zspace:step value (sup-to-inf). -zanydirection Don't flip images along z-axis (default). -help Print summary of command-line options and exit. -version Print the program's version number and exit. AUTHOR
Peter Neelin COPYRIGHTS
Copyright (C) 1993 by Peter Neelin SEE ALSO
minctoraw(1) $Date: 2004-05-20 21:52:08 $ MINCEXTRACT(1)
All times are GMT -4. The time now is 10:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy