commit bash-20180817 snapshot

This commit is contained in:
Chet Ramey
2018-08-20 17:03:01 -04:00
parent 07f38782cd
commit c2ccaa219a
17 changed files with 244 additions and 21 deletions
+30
View File
@@ -177,6 +177,36 @@ declare -a a=([0]="X" [1]="Y")
declare -a s=([0]="X" [1]="Y")
declare -a a=([0]="XY")
declare -a s=([0]="XY")
f: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
f1: after: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
done: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
f3:1
f3:2
f3:3
f3:4
f3:5
f3:6
f3:7
f3:8
f3:9
f3:10
f3:11
f3:12
f3:13
f3:14
f3:15
f3:16
f3:17
f3:18
f3:19
f3:20
before source: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
varenv15.in: before set: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
varenv15.in: after set: a b c d e f g h i j k l m n o p q r s t u v w x y z
after source 1: a b c d e f g h i j k l m n o p q r s t u v w x y z
varenv15.in: before set: one two three four five six seven eight nine ten
varenv15.in: after set: a b c d e f g h i j k l m n o p q r s t u v w x y z
after source 2: a b c d e f g h i j k l m n o p q r s t u v w x y z
a=z
a=b
a=z
+2
View File
@@ -240,5 +240,7 @@ ${THIS_SH} ./varenv13.sub
# localvar_inherit
${THIS_SH} ./varenv14.sub
${THIS_SH} ./varenv15.sub
# make sure variable scoping is done right
tt() { typeset a=b;echo a=$a; };a=z;echo a=$a;tt;echo a=$a
+3
View File
@@ -0,0 +1,3 @@
echo varenv15.in: before set: "$@"
set -- a b c d e f g h i j k l m n o p q r s t u v w x y z
echo varenv15.in: after set: "$@"
+38
View File
@@ -0,0 +1,38 @@
# check saving and restoring positional parameters around function calls
f()
{
echo $FUNCNAME: "$@"
}
f1()
{
f {1..50}
echo $FUNCNAME: after: $@
}
set -- {1..100}
f1 {1..20}
echo done: $@
f3()
{
echo $FUNCNAME:$1
shift
if [ $# -le 0 ]; then
return
fi
f3 "$@"
}
f3 {1..20}
# now let's try source with and without positional parameters
set -- {1..20}
echo before source: "$@"
. ./varenv15.in
echo after source 1: "$@"
. ./varenv15.in one two three four five six seven eight nine ten
echo after source 2: "$@"