backref.sh

来自「linux平台中」· Shell 代码 · 共 39 行

SH
39
字号
#!/bin/sh# Test that backrefs are local to regex.##: ${srcdir=.}failures=0# checking for a palindromeecho "radar" | ${GREP} -e '\(.\)\(.\).\2\1' > /dev/null 2>&1if test $? -ne 0 ; then        echo "backref: palindrome, test \#1 failed"        failures=1fi# hit hard with the `Bond' testsecho "civic" | ${GREP} -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\9\8\7\6\5\4\3\2\1$' > /dev/null 2>&1if test $? -ne 0 ; then        echo "Options: Bond, test \#2 failed"        failures=1fi# backref are local should be errorecho "123" | ${GREP} -e 'a\(.\)' -e 'b\1' > /dev/null 2>&1if test $? -ne 2 ; then	echo "Options: Backref not local, test \#3 failed"	failures=1fi# Pattern should faileecho "123" | ${GREP} -e '[' -e ']' > /dev/null 2>&1if test $? -ne 2 ; then	echo "Options: Compiled not local, test \#3 failed"	failures=1fiexit $failures

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?