Input parameter format | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Input parameter format

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 04-12-2006
mpang_ mpang_ is offline
Registered User
 
Join Date: Mar 2006
Last Activity: 16 November 2008, 8:20 PM EST
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Input parameter format

Hi,

My script expects 2 inputs and one of them is supposed to be time, I would like to check if the given input is in validate format (i.e. 16:00), could anyone help me out here? thanks!
Sponsored Links
    #2  
Old 04-12-2006
JunkYardWars JunkYardWars is offline
Registered User
 
Join Date: Mar 2006
Last Activity: 4 May 2006, 8:31 AM EDT
Location: Gurgaon
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
This is the prelim and u will have to look for tighter time checking ..but thats the start....
#! /bin/ksh
input=$1
echo $input
if [[ $input = [0-2][0-9]:[0-6][0-9] ]]
then
echo "Correct input"
else
echo "Incorrect input"
fi
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to pass the password as input parameter to scp eldonlck Shell Programming and Scripting 2 03-13-2012 12:52 AM
Check input parameter aishsimplesweet Shell Programming and Scripting 6 10-04-2010 01:27 PM
How to Get the File Input from Parameter wtolentino Shell Programming and Scripting 4 07-01-2009 03:38 PM
awk/input parameter wannalearn Shell Programming and Scripting 3 07-30-2007 01:42 PM
Shell script with input parameter jhmr7 UNIX for Dummies Questions & Answers 1 07-13-2005 12:04 AM



All times are GMT -4. The time now is 07:26 AM.