#!/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