OILS / test / gold / char-class.sh View on Github | oilshell.org

33 lines, 18 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# ./01-char-class.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -o errexit
9
10demo() {
11 [[ a == [a] ]]
12 [[ a != [^a] ]]
13
14 [[ a == [ab] ]]
15 [[ a != [^ab] ]]
16
17 [[ a == [[:alpha:]] ]]
18 [[ a != [^[:alpha:]] ]]
19 [[ 0 == [^[:alpha:]] ]]
20
21 # NOTE: there is only one negation. You can't mix them.
22 [[ 0 == [^[:alpha:]] ]]
23
24 if test -n "${BASH_VERSION:-}"; then
25 #echo hi
26 true
27 fi
28
29 echo
30 echo 'ALL PASSED'
31}
32
33"$@"