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: 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: 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 $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -4183,8 +4183,8 @@ description:
stdin: stdin:
set -o braceexpand set -o braceexpand
set +o posix set +o posix
set +o | fgrep posix >/dev/null && echo posix || echo noposix [[ $(set +o) == *@(-o posix)@(| *) ]] && echo posix || echo noposix
set +o | fgrep braceexpand >/dev/null && echo brex || echo nobrex [[ $(set +o) == *@(-o braceexpand)@(| *) ]] && echo brex || echo nobrex
echo {a,b,c} echo {a,b,c}
set +o braceexpand set +o braceexpand
echo {a,b,c} echo {a,b,c}
@ -4192,12 +4192,12 @@ stdin:
echo {a,b,c} echo {a,b,c}
set -o posix set -o posix
echo {a,b,c} echo {a,b,c}
set +o | fgrep posix >/dev/null && echo posix || echo noposix [[ $(set +o) == *@(-o posix)@(| *) ]] && echo posix || echo noposix
set +o | fgrep braceexpand >/dev/null && echo brex || echo nobrex [[ $(set +o) == *@(-o braceexpand)@(| *) ]] && echo brex || echo nobrex
set -o braceexpand set -o braceexpand
echo {a,b,c} echo {a,b,c}
set +o | fgrep posix >/dev/null && echo posix || echo noposix [[ $(set +o) == *@(-o posix)@(| *) ]] && echo posix || echo noposix
set +o | fgrep braceexpand >/dev/null && echo brex || echo nobrex [[ $(set +o) == *@(-o braceexpand)@(| *) ]] && echo brex || echo nobrex
expected-stdout: expected-stdout:
noposix noposix
brex brex
@ -4367,8 +4367,8 @@ description:
Reading the UTF-8 BOM should enable the utf8-hack flag Reading the UTF-8 BOM should enable the utf8-hack flag
category: pdksh,!dutf category: pdksh,!dutf
stdin: stdin:
"$__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 ':; 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'
expected-stdout: expected-stdout:
off off
on 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 # Copyright (c) 2007, 2008
# Thorsten “mirabilos” Glaser <tg@mirbsd.de> # Thorsten “mirabilos” Glaser <tg@mirbsd.de>
@ -90,7 +90,7 @@ function dirs {
typeset d typeset d
typeset -i isnoglob=0 fl=0 fv=0 fn=0 cpos=0 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 set -o noglob
while getopts ":lvn" d; do while getopts ":lvn" d; do
case $d { case $d {
@ -135,7 +135,7 @@ function popd {
typeset d fa typeset d fa
typeset -i isnoglob=0 n=1 typeset -i isnoglob=0 n=1
[[ $(set +o) == *-o\ noglob* ]] && isnoglob=1 [[ $(set +o) == *@(-o noglob)@(| *) ]] && isnoglob=1
set -o noglob set -o noglob
while getopts ":0123456789lvn" d; do while getopts ":0123456789lvn" d; do
case $d { case $d {
@ -174,7 +174,7 @@ function pushd {
typeset d fa typeset d fa
typeset -i isnoglob=0 n=1 typeset -i isnoglob=0 n=1
[[ $(set +o) == *-o\ noglob* ]] && isnoglob=1 [[ $(set +o) == *@(-o noglob)@(| *) ]] && isnoglob=1
set -o noglob set -o noglob
while getopts ":0123456789lvn" d; do while getopts ":0123456789lvn" d; do
case $d { case $d {