improve the use (parsing) of “set +o” output in the examples

This commit is contained in:
tg 2008-04-19 22:03:19 +00:00
parent 4d978af3da
commit 4ff0ca0f86
2 changed files with 13 additions and 13 deletions

18
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.176 2008/04/19 21:04:08 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.177 2008/04/19 22:03:18 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -4183,8 +4183,8 @@ description:
stdin:
set -o braceexpand
set +o posix
set +o | fgrep posix >/dev/null && echo posix || echo noposix
set +o | fgrep braceexpand >/dev/null && echo brex || echo nobrex
[[ $(set +o) == *@(-o posix)@(| *) ]] && echo posix || echo noposix
[[ $(set +o) == *@(-o braceexpand)@(| *) ]] && echo brex || echo nobrex
echo {a,b,c}
set +o braceexpand
echo {a,b,c}
@ -4192,12 +4192,12 @@ stdin:
echo {a,b,c}
set -o posix
echo {a,b,c}
set +o | fgrep posix >/dev/null && echo posix || echo noposix
set +o | fgrep braceexpand >/dev/null && echo brex || echo nobrex
[[ $(set +o) == *@(-o posix)@(| *) ]] && echo posix || echo noposix
[[ $(set +o) == *@(-o braceexpand)@(| *) ]] && echo brex || echo nobrex
set -o braceexpand
echo {a,b,c}
set +o | fgrep posix >/dev/null && echo posix || echo noposix
set +o | fgrep braceexpand >/dev/null && echo brex || echo nobrex
[[ $(set +o) == *@(-o posix)@(| *) ]] && echo posix || echo noposix
[[ $(set +o) == *@(-o braceexpand)@(| *) ]] && echo brex || echo nobrex
expected-stdout:
noposix
brex
@ -4367,8 +4367,8 @@ description:
Reading the UTF-8 BOM should enable the utf8-hack flag
category: pdksh,!dutf
stdin:
"$__progname" -c ':; x=$(set +o); if [[ $x = *utf8* ]]; then print on; else print off; fi'
"$__progname" -c ':; x=$(set +o); if [[ $x = *utf8* ]]; then print on; else print off; fi'
"$__progname" -c ':; if [[ $(set +o) = *@(-o utf8-hack)@(| *) ]]; then print on; else print off; fi'
"$__progname" -c ':; if [[ $(set +o) = *@(-o utf8-hack)@(| *) ]]; then print on; else print off; fi'
expected-stdout:
off
on

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.31 2008/04/11 20:14:02 tg Rel $
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.32 2008/04/19 22:03:19 tg Stab $
#-
# Copyright (c) 2007, 2008
# Thorsten “mirabilos” Glaser <tg@mirbsd.de>
@ -90,7 +90,7 @@ function dirs {
typeset d
typeset -i isnoglob=0 fl=0 fv=0 fn=0 cpos=0
[[ $(set +o) == *-o\ noglob* ]] && isnoglob=1
[[ $(set +o) == *@(-o noglob)@(| *) ]] && isnoglob=1
set -o noglob
while getopts ":lvn" d; do
case $d {
@ -135,7 +135,7 @@ function popd {
typeset d fa
typeset -i isnoglob=0 n=1
[[ $(set +o) == *-o\ noglob* ]] && isnoglob=1
[[ $(set +o) == *@(-o noglob)@(| *) ]] && isnoglob=1
set -o noglob
while getopts ":0123456789lvn" d; do
case $d {
@ -174,7 +174,7 @@ function pushd {
typeset d fa
typeset -i isnoglob=0 n=1
[[ $(set +o) == *-o\ noglob* ]] && isnoglob=1
[[ $(set +o) == *@(-o noglob)@(| *) ]] && isnoglob=1
set -o noglob
while getopts ":0123456789lvn" d; do
case $d {