Sponsored Content
Top Forums Shell Programming and Scripting To Check whether the Input is a Year or Not? Post 302682553 by Don Cragun on Monday 6th of August 2012 11:38:03 AM
Old 08-06-2012
Note that
Code:
case $Test_Var in

[1000-9999] )  echo "It is a Year";;
 * )           echo "Is is not a Year";;
esac

will match a single character that is 1, 0, 0, any single digit in the range 0 through 9, 9, 9, or 9. So if Test_var had been set to "6", it would say it is a year. Bracket expressions don't look for ranges of numeric values.

Hope this helps you understand what was going wrong.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What can i do to check that the input is all alphabet.. ?

What can i do to check that the input is all alphabet.. ? (4 Replies)
Discussion started by: XXXXXXXXXX
4 Replies

2. Shell Programming and Scripting

Check on Input

HI all, I would like to know how the user can be restricted for entering only the number and not characters in sheel scripts.. Suppose code is like this echo 'Enter the number' read Value Now user may enter 'a' as value... But i want to disallow him for entering characters other than... (3 Replies)
Discussion started by: dhananjaysk
3 Replies

3. Shell Programming and Scripting

How to check for a valid numeric input

Hi Folks, I'm using bash script. I would like to check whether input is a number or not.(Only positive numbers).. if space or non numeric is entered, it should say "invalid input". pls help.. thanks in adv. Br/// Vijay. (1 Reply)
Discussion started by: Vijayakumarpc
1 Replies

4. UNIX for Dummies Questions & Answers

check the input

how to check whether a given input is a number or a string? (1 Reply)
Discussion started by: Shilpi
1 Replies

5. Programming

How to check an input variable

Suppose we have a simple situation, like the following C++ instructions: int x; cout << "Insert x: "; cin >> x; while ( x-- < 0 ) ; Of course, if it is written something different from an integer, the while loop shall not end. So, how can we check if the input x is of the right type? (2 Replies)
Discussion started by: Luke Bonham
2 Replies

6. Shell Programming and Scripting

Check input parameter

Hi all i need to check that if user has passed any input parameter while executing he shell script like ./test1.sh -a"-v" then do smothing if user execute the script without giving input paramater then ./test1.sh then do something how can we check this input parameter (6 Replies)
Discussion started by: aishsimplesweet
6 Replies

7. Shell Programming and Scripting

Input file check

Hi, I have a script which runs daily. It gets 3 input files test1,test2,test3. I want to do a validation in my script to make sure i have all the 3 files available before running. If any one of the file is missing i want to break the script. Could you please help me with this request. ... (1 Reply)
Discussion started by: Krrishv
1 Replies

8. Shell Programming and Scripting

Check user input

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. UNIX for Dummies Questions & Answers

Check Column corresponding to input

I have a file which extracts data from an HTML file For Eg HTML file contains: New York;ABC;145;Yes;YES;No New York;BCD;113;Yes;YES;No New York;NAS;63;Yes;YES;No ------------------------ London-48;CBT;16;Yes;YES;No London-48;CME;17;Yes;YES;No London-48;EUR;52;Yes;YES;No... (7 Replies)
Discussion started by: newkid.7955
7 Replies

10. Shell Programming and Scripting

Check whether input is numeric

Hello there, find below for my code first: $pdp_asaba=`cat /tmp/temp_total | grep asaba | sed 's/*//g'` if ]] then pdp_asaba=0 fi $pdp_abuja=`cat /tmp/temp_total | grep abuja | sed 's/*//g'` if ]] then pdp_abuja=0 fi $pdp_ojota=`cat /tmp/temp_total | grep ojota | sed 's/*//g'` if ... (3 Replies)
Discussion started by: infinitydon
3 Replies
HTML::FormHandler::Field::DateTime(3pm) 		User Contributed Perl Documentation		   HTML::FormHandler::Field::DateTime(3pm)

NAME
HTML::FormHandler::Field::DateTime - compound DateTime field VERSION
version 0.40013 DESCRIPTION
This is a compound field that requires you to define the subfields for month/day/year/hour/minute. Widget type is 'compound'. If you want to use drop-down select boxes for your DateTime, you can select fields like: has_field 'my_date' => ( type => 'DateTime' ); has_field 'my_date.month' => ( type => 'Month' ); has_field 'my_date.day' => ( type => 'MonthDay' ); has_field 'my_date.year' => ( type => 'Year' ); has_field 'my_date.hour' => ( type => 'Hour' ); has_field 'my_date.minute' => ( type => 'Minute' ); If you want simple input fields: has_field 'my_date' => ( type => 'DateTime' ); has_field 'my_date.month' => ( type => 'Integer', range_start => 1, range_end => 12 ); has_field 'my_date.day' => ( type => 'Integer', range_start => 1, range_end => 31 ); Customizable error: 'datetime_invalid' (default = "Not a valid DateTime") See the 'Date' field for a single input date field. AUTHOR
FormHandler Contributors - see HTML::FormHandler COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Gerda Shank. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-25 HTML::FormHandler::Field::DateTime(3pm)
All times are GMT -4. The time now is 05:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy