Files
hpr_website/www/eps/hpr2679/hpr2679_bash13_ex3.sh

15 lines
312 B
Bash
Executable File

#!/bin/bash
# =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~
# Experimenting with backreferences in Bash regular expressions
# =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~ =~
re='(\<.{1,10}\>) \1'
if [[ $1 =~ $re ]]; then
echo "Matched: $1"
else
echo "No match: $1"
fi