Sponsored Content
Top Forums Shell Programming and Scripting TCSH user input error checking Post 302749845 by thibodc on Saturday 29th of December 2012 04:11:20 PM
Old 12-29-2012
TCSH user input error checking

This was taken down recently because it appeared to be homework, but it isn't. It's for a script I am working on at work. Thanks for the help.

How do you check that user inputs (arguments 1 and 2) are both numbers and are at least 5 digits in length?
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

TCSH.need help.take input during a while/end loop

I am writting a script in csh and I am blanking out on how I code in the ability to process user input in the middle of a while/end loop. while(1) args.. end it is a simple script, and I want to add hotkey functions, like q to quit, z to zero counters, etc.. Google has not been very... (1 Reply)
Discussion started by: seg
1 Replies

2. Shell Programming and Scripting

tcsh user failed to call library in ksh program

Hi folks, I'm trying to organize functions in my ksh program into libraries. If I run my program as any ksh user it will succeed. Only when I run my program as tcsh user (i.e oracle) I failed. Example ======= The ksh code: tornado:/tmp # cat nir.ksh #! /bin/ksh cdromPath=`pwd`... (1 Reply)
Discussion started by: nir_s
1 Replies

3. Shell Programming and Scripting

tcsh and user input

Here is my script: echo "var 1:" read varone echo "$varone" When I run in via ksh the script runs successfully. However when I run it via tcsh I get "varone: Undefine variable" Does the name command not work with tcsh or do I need some additional modification? Is there a way to get... (1 Reply)
Discussion started by: bonesy
1 Replies

4. UNIX for Advanced & Expert Users

Remote commands fail for tcsh user

I'm more familiar with bash/ksh that csh/tcsh. With that said, I recently ran across a problem with tcsh. Our system admin recently installed purify on our solaris 8 system. In order to use purify you have to execute a Rational script in order to setup the paths and some environment variables... (3 Replies)
Discussion started by: sszd
3 Replies

5. Programming

Checking columns in SQL, comparing user input and sizes.

I'm writing a KSH shell script that's using SQL though DB2. If I have a table defined and populated db2 "create table tb(num int,letter char(4))" db2 "insert into tb values(111,a) db2 "insert into tb values(112,b) db2 "insert into tb values(111,c) How can I check if a letter user... (0 Replies)
Discussion started by: busdude
0 Replies

6. Shell Programming and Scripting

how to prompt the user to enter an array in tcsh

Hello, I am writing a script that requires the user to enter a string of numbers: ex: 134 345 865 903 This command only allows for one variable to be entered: set "var" = $< and than once I got the array I want to change it to a list with each input on a different line: ... (1 Reply)
Discussion started by: smarones
1 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

TCSH user input checks

I would like to check user input for arguments 1 and 2 for my Solaris TCSH script for the following: 1. That both user input arguments are numbers. 2. That they are both at least 5 digits. Thanks for the help. (1 Reply)
Discussion started by: thibodc
1 Replies

9. Shell Programming and Scripting

Checking the user input in perl for characters and length

My question is basically as the title says. How can I check a user inputted string is only certain characters long (for example, 3 characters long) and how do I check a user inputted string only contains certain characters (for example, it should only contain the characters 'u', 'a', 'g', and 'c')... (4 Replies)
Discussion started by: Eric1
4 Replies
CheckDigits::M11_011(3pm)				User Contributed Perl Documentation				 CheckDigits::M11_011(3pm)

NAME
CheckDigits::M11_011 - compute check digits for VAT Registration Number (NL) SYNOPSIS
use Algorithm::CheckDigits; $ustid = CheckDigits('ustid_nl'); if ($ustid->is_valid('123456782')) { # do something } if ($ustid->is_valid('123456782B04')) { # do something } $cn = $ustid->complete('12345678'); # $cn = '123456782' $cn = $ustid->complete('12345678.B04'); # $cn = '123456782B04' $cd = $ustid->checkdigit('123456782'); # $cd = '2' $cd = $ustid->checkdigit('123456782B04'); # $cd = '2' $bn = $ustid->basenumber('123456782'); # $bn = '12345678'; $bn = $ustid->basenumber('123456782B04'); # $bn = '12345678.B04'; DESCRIPTION
This VATRN has 12 "digits", the third last must be a B, the fourth last is the checkdigit. I don't know anything about the meaning of the last two digits. You may use the whole VATRN or only the first eight digits to compute the checkdigit with this module. ALGORITHM 1. Beginning right with the digit before the checkdigit all digits are weighted with their position. I.e. the digit before the checkdigit is multiplied with 2, the next with 3 and so on. 2. The weighted digits are added. 3. The sum from step 2 is taken modulo 11. 4. If the sum from step 3 is 10, the number is discarded. METHODS is_valid($number) Returns true only if $number consists solely of numbers and hyphens and the two digits in the middle are valid check digits according to the algorithm given above. Returns false otherwise, complete($number) The check digit for $number is computed and inserted into the middle of $number. Returns the complete number with check digit or '' if $number does not consist solely of digits, hyphens and spaces. basenumber($number) Returns the basenumber of $number if $number has a valid check digit. Return '' otherwise. checkdigit($number) Returns the check digits of $number if $number has valid check digits. Return '' otherwise. EXPORT None by default. SEE ALSO
perl, CheckDigits, www.pruefziffernberechnung.de, AUTHOR
Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de> COPYRIGHT AND LICENSE
Copyright 2004,2005 by Mathias Weidner This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2008-05-17 CheckDigits::M11_011(3pm)
All times are GMT -4. The time now is 01:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy