Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Input parameter format

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 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


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
Old Unix and Linux 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
echo $input
if [[ $input = [0-2][0-9]:[0-6][0-9] ]]
echo "Correct input"
echo "Incorrect input"
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 04:34 PM.