Move under www to ease rsync
This commit is contained in:
24
www/eps/hpr2669/hpr2669_bash12_ex4.sh
Executable file
24
www/eps/hpr2669/hpr2669_bash12_ex4.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Building a regular expression to match a simple-format ISO8601 date
|
||||
#
|
||||
|
||||
re='^[0-9]{4}(-[0-9]{2}){2}$'
|
||||
|
||||
#
|
||||
# The date is expected as the only argument
|
||||
#
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 ISO8601_date"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Validate against the regex
|
||||
#
|
||||
if [[ $1 =~ $re ]]; then
|
||||
echo "$1 is a valid date"
|
||||
else
|
||||
echo "$1 is not a valid date"
|
||||
fi
|
||||
Reference in New Issue
Block a user