File: case-fold-backslash-w

package info (click to toggle)
grep 3.11-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,392 kB
  • sloc: ansic: 95,031; sh: 12,720; perl: 606; makefile: 386; awk: 71; sed: 16
file content (13 lines) | stat: -rwxr-xr-x 595 bytes parent folder | download | duplicates (10)
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