Advertisement

06.10.2008 at 11:45AM PDT, ID: 23473431
[x]
Attachment Details

How to prevent some case when input datetime ?

Asked by megashares in Bourne-Again Shell (bash), Bourne Shell (sh), Shell Scripting

Tags: bash, Suse

This code below is check leap year and invalid day completed.
 But I have some problem.I try to make an trap.People insert blank space when enter day, and program not accept and sad input invalid day again ( not blank space).  I try any time it not worked :|. I new to shell scripting. Please helpStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
#!/bin/bash
result="FALSE"
while [ $result = "FALSE" ]
do 
echo -n "Enter day(mm/dd/yyyy): " 
read datetime
if date --date="$datetime" >/dev/null
then
result="TRUE"
else 
result="FALSE"
fi
done
 
Loading Advertisement...
 
[+][-]06.10.2008 at 01:06PM PDT, ID: 21754591

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.10.2008 at 01:18PM PDT, ID: 21754692

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.10.2008 at 01:39PM PDT, ID: 21754862

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Bourne-Again Shell (bash), Bourne Shell (sh), Shell Scripting
Tags: bash, Suse
Sign Up Now!
Solution Provided By: Tintin
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.10.2008 at 02:29PM PDT, ID: 21755260

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.18.2008 at 01:31PM PDT, ID: 21816897

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.19.2008 at 12:43AM PDT, ID: 21820031

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.22.2008 at 10:38PM PDT, ID: 21843717

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.27.2008 at 02:47AM PDT, ID: 21882056

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628