file.sh

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

SH
60
字号
#!/bin/sh# Test for POSIX.2 options for grep## grep -E -f pattern_file file# grep -F -f pattern_file file# grep -G -f pattern_file file#: ${srcdir=.}failures=0cat <<EOF >patfileradarMILESGNUEOF# matchecho "miles" |  ${GREP} -i -E -f patfile > /dev/null 2>&1if test $? -ne 0 ; then        echo "File_pattern: Wrong status code, test \#1 failed"        failures=1fi# match echo "GNU" | ${GREP} -G -f patfile  > /dev/null 2>&1if test $? -ne 0 ; then        echo "File_pattern: Wrong status code, test \#2 failed"        failures=1fi# checking for no matchecho "ridar" | ${GREP} -F -f patfile > /dev/null 2>&1if test $? -ne 1 ; then	echo "File_pattern: Wrong status code, test \#3 failed"	failures=1ficat <<EOF >patfileEOF# empty pattern : every matchecho "abbcd" | ${GREP} -F -f patfile > /dev/null 2>&1if test $? -ne 0 ; then	echo "File_pattern: Wrong status code, test \#4 failed"	failures=1ficp /dev/null patfile# null pattern : no matchecho "abbcd" | ${GREP} -F -f patfile > /dev/null 2>&1if test $? -ne 1 ; then	echo "File_pattern: Wrong status code, test \#5 failed"	failures=1fiexit $failures

⌨️ 快捷键说明

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