Move under www to ease rsync
This commit is contained in:
23
www/eps/hpr2679/hpr2679_bash13_ex1.sh
Executable file
23
www/eps/hpr2679/hpr2679_bash13_ex1.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Three word regular expression
|
||||
#
|
||||
re='^([a-zA-Z]+) +([a-zA-Z]+) +([a-zA-Z]+) *\.?'
|
||||
|
||||
#
|
||||
# A sentence is expected as the only argument
|
||||
#
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 sentence"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Sentence: $1"
|
||||
if [[ $1 =~ $re ]]; then
|
||||
echo "Matched"
|
||||
for i in {0..3}; do
|
||||
printf '%2d %s\n' $i "${BASH_REMATCH[$i]}"
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user