mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-06 10:12:38 +02:00
commit bash-20141121 snapshot
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
export THIS_SH PATH
|
||||
|
||||
rm -f /tmp/xx
|
||||
|
||||
/bin/sh "$@"
|
||||
@@ -54,3 +54,10 @@ remaining args:
|
||||
0
|
||||
./getopts7.sub: line 4: getopts: `opt-var': not a valid identifier
|
||||
remaining args:
|
||||
opt: x
|
||||
opt: y
|
||||
opt: a
|
||||
opt: b
|
||||
opt: c
|
||||
opt: z
|
||||
$1 = a
|
||||
|
||||
@@ -36,3 +36,6 @@ ${THIS_SH} ./getopts6.sub -ac
|
||||
echo $? # this should be 2
|
||||
|
||||
${THIS_SH} ./getopts7.sub -a
|
||||
|
||||
${THIS_SH} ./getopts8.sub
|
||||
${THIS_SH} ./getopts9.sub
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# getopts tests
|
||||
# this should fail
|
||||
getopts
|
||||
echo $?
|
||||
getopts opts
|
||||
echo $?
|
||||
|
||||
# maybe someday we will have a ksh93-like -a argument to set the name
|
||||
# used in error messages, but not yet
|
||||
getopts -a opts name
|
||||
|
||||
${THIS_SH} ./getopts1.sub -a -b bval one two three
|
||||
# make sure getopts works when there are more than 9 positional parameters
|
||||
${THIS_SH} ./getopts1.sub -a -b bval one two three four five six seven eight nine ten eleven twelve
|
||||
${THIS_SH} ./getopts1.sub -a -b
|
||||
|
||||
${THIS_SH} ./getopts2.sub -ad -c cval three four five
|
||||
|
||||
${THIS_SH} ./getopts3.sub
|
||||
|
||||
# make sure that `-b bval' and `-bbval' are equivalent
|
||||
${THIS_SH} ./getopts4.sub -a -b bval one two three
|
||||
${THIS_SH} ./getopts4.sub -a -bbval one two three
|
||||
# this tests `silent' error reporting
|
||||
${THIS_SH} ./getopts4.sub -a -b
|
||||
${THIS_SH} ./getopts4.sub -a -c
|
||||
|
||||
# make sure that `--' can be used to end the list of options
|
||||
${THIS_SH} ./getopts4.sub -a -- -b bval one two three
|
||||
|
||||
${THIS_SH} ./getopts5.sub -a -c
|
||||
|
||||
${THIS_SH} ./getopts6.sub -a
|
||||
${THIS_SH} ./getopts6.sub -a -c
|
||||
${THIS_SH} ./getopts6.sub -ac
|
||||
echo $? # this should be 2
|
||||
|
||||
${THIS_SH} ./getopts7.sub -a
|
||||
@@ -0,0 +1,13 @@
|
||||
f()
|
||||
{
|
||||
typeset OPTIND=1
|
||||
typeset opt
|
||||
|
||||
while getopts ":abcxyz" opt
|
||||
do
|
||||
echo opt: "$opt"
|
||||
if [[ $opt = y ]]; then f -abc ; fi
|
||||
done
|
||||
}
|
||||
|
||||
f -xyz
|
||||
@@ -0,0 +1,16 @@
|
||||
f()
|
||||
{
|
||||
OPTIND=4
|
||||
|
||||
echo \$1 = $1
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
while getopts abcdefg opt
|
||||
do
|
||||
f $opt
|
||||
done
|
||||
}
|
||||
|
||||
main -abc
|
||||
@@ -0,0 +1,50 @@
|
||||
:; ./shx
|
||||
|
||||
sh:
|
||||
<&$fd ok
|
||||
nlbq Mon Aug 3 02:45:00 EDT 1992
|
||||
bang geoff
|
||||
quote 712824302
|
||||
setbq defmsgid=<1992Aug3.024502.6176@host>
|
||||
bgwait sleep done... wait 6187
|
||||
|
||||
|
||||
bash:
|
||||
<&$fd ok
|
||||
nlbq Mon Aug 3 02:45:09 EDT 1992
|
||||
bang geoff
|
||||
quote 712824311
|
||||
setbq defmsgid=<1992Aug3.024512.6212@host>
|
||||
bgwait sleep done... wait 6223
|
||||
|
||||
|
||||
ash:
|
||||
<&$fd shx1: 4: Syntax error: Bad fd number
|
||||
nlbq Mon Aug 3 02:45:19 EDT 1992
|
||||
bang geoff
|
||||
quote getdate: `"now"' not a valid date
|
||||
|
||||
setbq defmsgid=<1992Aug3.` echo 024521
|
||||
bgwait sleep done... wait 6241
|
||||
|
||||
|
||||
ksh:
|
||||
<&$fd ok
|
||||
nlbq ./shx: 6248 Memory fault - core dumped
|
||||
bang geoff
|
||||
quote getdate: `"now"' not a valid date
|
||||
|
||||
setbq defmsgid=<1992Aug3.024530.6257@host>
|
||||
bgwait no such job: 6265
|
||||
wait 6265
|
||||
sleep done...
|
||||
|
||||
zsh:
|
||||
<&$fd ok
|
||||
nlbq Mon Aug 3 02:45:36 EDT 1992
|
||||
bang shx3: event not found: /s/ [4]
|
||||
quote 712824337
|
||||
setbq defmsgid=<..6290@host>
|
||||
bgwait shx7: unmatched " [9]
|
||||
sleep done...
|
||||
:;
|
||||
@@ -0,0 +1,10 @@
|
||||
#! /bin/sh
|
||||
for cmd in sh bash ash ksh zsh
|
||||
do
|
||||
echo
|
||||
echo $cmd:
|
||||
for demo in shx?
|
||||
do
|
||||
$cmd $demo
|
||||
done
|
||||
done
|
||||
Reference in New Issue
Block a user