File: case-fold-backslash-w

package info (click to toggle)
grep 3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 13,404 kB
  • sloc: ansic: 77,930; sh: 10,347; perl: 567; makefile: 364; awk: 71; sed: 16
file content (13 lines) | stat: -rwxr-xr-x 595 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
# test that \W works on case-insensitive matches.  It used to become \w.
# Derived from https://savannah.gnu.org/bugs/?28162
. "${srcdir=.}/init.sh"; path_prepend_ ../src

if echo foo bar | LANG=C.ASCII grep '^foo\W'; then
  echo foo bar | LANG=C.ASCII grep -i '^foo\W' || fail_ ASCII insensitive
else
  echo foo bar | LANG=C grep '^foo\W' || fail_ LANG=C sensitive
  echo foo bar | LANG=C grep -i '^foo\W' || fail_ LANG=C insensitive
fi
echo foo bar | LANG=en_US.UTF-8 grep '^foo\W' || fail_ UTF-8 sensitive
echo foo bar | LANG=en_US.UTF-8 grep -i '^foo\W' || fail_ UTF-8 insensitive