Move under www to ease rsync
This commit is contained in:
27
www/eps/hpr2669/hpr2669_bash12_ex1.sh
Executable file
27
www/eps/hpr2669/hpr2669_bash12_ex1.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~
|
||||
# Experimenting with the meaning of the statement in the GNU Bash Manual:
|
||||
# "Any part of the pattern may be quoted to force the quoted portion to
|
||||
# be matched as a string."
|
||||
# -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~ -~
|
||||
|
||||
server="hackerpublicradio.org"
|
||||
|
||||
#
|
||||
# Try some regular expressions in a loop. The first is a standard type, but
|
||||
# the second and third use a quoted regular expression metacharacter trying
|
||||
# different quotes.
|
||||
#
|
||||
for re in \
|
||||
'^(hacker|hobby)publicradio\.org$' \
|
||||
'^(hacker|hobby)publicradio"."org$' \
|
||||
"^(hacker|hobby)publicradio'.'org$"
|
||||
do
|
||||
echo "Using regular expression: $re"
|
||||
if [[ $server =~ $re ]]; then
|
||||
echo "This is HPR"
|
||||
else
|
||||
echo "No match"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user