]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/shopt.tests
bash-5.1 distribution sources and documentation
[thirdparty/bash.git] / tests / shopt.tests
1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
5 #
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
10 #
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 #
14 # let's try an error message first
15 shopt -z
16
17 # first, set up a known environment
18 shopt -u cdable_vars
19 shopt -s cdspell
20 shopt -u checkhash
21 shopt -u checkwinsize
22 shopt -s cmdhist
23 shopt -u dotglob
24 shopt -u execfail
25 shopt -s expand_aliases
26 shopt -u extglob
27 shopt -u histreedit
28 shopt -u histappend
29 shopt -u histverify
30 shopt -s hostcomplete
31 shopt -u huponexit
32 shopt -s interactive_comments
33 shopt -u lithist
34 shopt -u mailwarn
35 shopt -u nocaseglob
36 shopt -u nullglob
37 shopt -s promptvars
38 shopt -u shift_verbose
39 shopt -s sourcepath
40 shopt -u xpg_echo
41
42 # Now, start checking the output
43 builtin printf -- "--\n"
44 shopt -p # list 'em all
45 builtin printf -- "--\n"
46 # test specific variables
47 shopt -p huponexit
48 shopt -p checkwinsize
49 shopt -p sourcepath
50
51 builtin printf -- "--\n"
52 shopt -s -p
53 builtin printf -- "--\n"
54 shopt -u -p
55 builtin printf -- "--\n"
56 shopt -u
57
58 # Now set up another known environment
59 set +o allexport
60 set -o braceexpand
61 set +o errexit
62 set -o hashall
63 set -o histexpand
64 set +o keyword
65 set -o monitor
66 set +o noclobber
67 set +o noexec
68 set +o noglob
69 set +o notify
70 set +o nounset
71 set +o onecmd
72 set +o physical
73 set -o privileged
74 set +o verbose
75 set +o xtrace
76 set -o history
77 set +o ignoreeof
78 set -o interactive-comments
79 set +o posix
80 set -o emacs
81 set +o vi
82
83 # list 'em all
84 builtin printf -- "--\n"
85 shopt -o -p
86
87 builtin printf -- "--\n"
88 set -o
89 builtin printf -- "--\n"
90 set +o
91
92 # test specific variables
93 builtin printf -- "--\n"
94 shopt -p -o history
95 shopt -p -o verbose
96
97 builtin printf -- "--\n"
98 shopt -s -p -o
99 builtin printf -- "--\n"
100 shopt -u -p -o
101 builtin printf -- "--\n"
102 shopt -u -o
103
104 # errors
105 builtin printf -- "--\n"
106 shopt -p xyz1
107 shopt -o -p xyz1
108
109 ${THIS_SH} ./shopt1.sub
110
111 # test whether or not temporary variable assignments that manipulate posix
112 # mode restore the previous state or the default non-posix state
113 ${THIS_SH} -c 'shopt -s expand_aliases ; shopt expand_aliases ; POSIXLY_CORRECT=y true ; shopt expand_aliases'