Sponsored Content
Full Discussion: How to Validate
Top Forums Shell Programming and Scripting How to Validate Post 302137840 by SanjayLinux on Thursday 27th of September 2007 06:51:57 AM
Old 09-27-2007
Ghost Thanks for your quick response !!
Now I am using that date with in my script
-------------
echo -n "Enter Time schedule in the following format [HH:MM],[HH:MM],..:"
read Ext_Sch
date -d $Ext_Sch
count=`echo $?`
if [ $count -eq 0 ]
then
echo Valid
else
echo Wrong
fi
------------
[Sanjaytmp]$ sh tt.sh
Enter Time schedule in the following format [HH:MM],[HH:MM],..:28:33
date: invalid date `28:33'
Wrong
---------------------
[Sanjaytmp]$Enter Time schedule in the following format [HH:MM],[HH:MM],..:23:45
Thu Sep 27 23:45:00 IST 2007
Valid


Here I am getting the message in my output(show in bold letter) as well that I dun want.
Could you help me how I will ignore it.

Thanks
Sanjay
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

validate

hi need help here, a bit of code im doing requires a number to be enetered i have got validation and loop if its outside a ceratain range, but was wondering what code i need to validate if a character has been entered. cheers (3 Replies)
Discussion started by: ruffenator
3 Replies

2. Shell Programming and Scripting

validate against a file

Hello all, I am having problem in writing a if condition for the following: I have a file Instance.dat which has: #Server Environment server1 dev server2 dev server3 sit #!/bin/ksh ENV=dev for i in $( cat Instances.dat | grep -v '#' |awk {'print $2'} ) do if ]... (7 Replies)
Discussion started by: chiru_h
7 Replies

3. Shell Programming and Scripting

How to validate a column?

Dear guru's, I am learning shellscripting and now I 'm struggeling with this problem: When the number in the left column is equal or higer then 200, I want to send an email to "postmaster" @ the corresponding domain in the right column. 220 shoes.com 217 dishwashers.net 209 ... (11 Replies)
Discussion started by: algernonz
11 Replies

4. Shell Programming and Scripting

How to validate an IP address

hi I need a simple script to do the following. I need to check the user input for 1. quad dotted notation. 2. check that all of the inputs are numeric and within 1-255 range. Could someone please help me? I tried to use egrep to check for dotted notation. quad=1.1.1.12 ... (5 Replies)
Discussion started by: sabina
5 Replies

5. Shell Programming and Scripting

validate input

the user inputs names that have to be inside square brackets I want to check if the user puts the brackets and if not ask him to re-enter the names (9 Replies)
Discussion started by: DDoS
9 Replies

6. Shell Programming and Scripting

Validate and Calculate

Hi, i am trying to validate 2 variables and then subtract, the following code works well in AiX but when i try in Solaris it doesnt work. ((TIME1>TIME2)) && ((TIME2=TIME2+864)) ((DIF=TIME2-TIME1)) echo difference = $DIF Seconds is there any way the validation can be done using... (2 Replies)
Discussion started by: Shellslave
2 Replies

7. Shell Programming and Scripting

Validate the file

How do we validate the header file. The file number should increament by 1 (position 17 to 19) if not abend the process. first week ABC0001 20100101123 second week ABC0001 20100108124 Third week ABC0001 20100115125 (7 Replies)
Discussion started by: zooby
7 Replies

8. Shell Programming and Scripting

Need to validate that all 24 hr are in a table

I have a table that looks like this, but for a whole year: Hourly weather history for XXX 7 Jun 0:00 Clear weather 28 1:00 Clear weather 23 2:00 Clear weather 21 3:00 Clear weather 22 4:00 Clear weather 22 5:00 Clear weather 22 6:00 Clear weather 23 7:00 Clear... (12 Replies)
Discussion started by: paulyester
12 Replies

9. Shell Programming and Scripting

validate timestamp

How to validate the user supplied timestamp? Ther requirement is as follows. While invoking the script, the parameters passed to the script are minimum and maixmum timestamps. let's say min_tstmp and max_tstmp ksh abc.ksh 2011-09-01-00:00:00 2011-12-01-00:00:00 so... (3 Replies)
Discussion started by: kmanivan82
3 Replies

10. Shell Programming and Scripting

Please help me validate script

Hi Guys, Im a newbie to scripting and have a small assignment. can someone please confirm if the script i have written would work fine as we dont have a test server to test :( Scenario - copy 2 files from an ftp server (windows) to a linux machine (a perticular folder). run 2 different... (0 Replies)
Discussion started by: nishantvshah
0 Replies
Attribute::Params::Validate(3)				User Contributed Perl Documentation			    Attribute::Params::Validate(3)

NAME
Attribute::Params::Validate - Validate method/function parameters using attributes SYNOPSIS
use Attribute::Params::Validate qw(:all); # takes named params (hash or hashref) # foo is mandatory, bar is optional sub foo : Validate( foo => 1, bar => 0 ) { ... } # takes positional params # first two are mandatory, third is optional sub bar : ValidatePos( 1, 1, 0 ) { ... } # for some reason Perl insists that the entire attribute be on one line sub foo2 : Validate( foo => { type => ARRAYREF }, bar => { can => [ 'print', 'flush', 'frobnicate' ] }, baz => { type => SCALAR, callbacks => { 'numbers only' => sub { shift() =~ /^d+$/ }, 'less than 90' => sub { shift() < 90 } } } ) { ... } # note that this is marked as a method. This is very important! sub baz : Validate( foo => { type => ARRAYREF }, bar => { isa => 'Frobnicator' } ) method { ... } DESCRIPTION
The Attribute::Params::Validate module allows you to validate method or function call parameters just like Params::Validate does. However, this module allows you to specify your validation spec as an attribute, rather than by calling the "validate" routine. Please see Params::Validate for more information on how you can specify what validation is performed. EXPORT This module exports everthing that Params::Validate does except for the "validate" and "validate_pos" subroutines. ATTRIBUTES o Validate This attribute corresponse to the "validate" subroutine in Params::Validate. o ValidatePos This attribute corresponse to the "validate_pos" subroutine in Params::Validate. OO If you are using this module to mark methods for validation, as opposed to subroutines, it is crucial that you mark these methods with the ":method" attribute, as well as the "Validate" or "ValidatePos" attribute. If you do not do this, then the object or class used in the method call will be passed to the validation routines, which is probably not what you want. CAVEATS You must put all the arguments to the "Validate" or "ValidatePos" attribute on a single line, or Perl will complain. SEE ALSO
Params::Validate AUTHOR
Dave Rolsky, <autarch@urth.org> perl v5.12.1 2010-07-05 Attribute::Params::Validate(3)
All times are GMT -4. The time now is 01:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy