Imported from ../bash-3.1.tar.gz.
[platform/upstream/bash.git] / tests / dollar-at-star
index 307bf31..25c2443 100755 (executable)
@@ -117,3 +117,110 @@ unset IFS
 recho "$@"
 recho $@
 recho "$*"
+
+IFS=:
+
+# special variables
+set -- 1 2 3 4 5 6 7 8 9 10
+
+bar=${*}
+foo=$*
+echo foo = "$foo"
+echo bar = "$bar"
+
+foo1=$@
+bar1=${@}
+
+echo foo1 = "$foo1"
+echo bar1 = "$bar1"
+
+foo2="$*"
+bar2="${*}"
+
+echo foo2 = "$foo2"
+echo bar2 = "$bar2"
+
+eval foo3='$*' bar3='${*}'
+echo foo3 = "$foo3"
+echo bar3 = "$bar3"
+
+case $* in
+*\:*)  echo ok 1;;
+*)     echo bad 1;;
+esac
+
+case $@ in
+*\:*)  echo bad 2;;
+*)     echo ok 2;;
+esac
+
+case "$*" in
+*\:*)  echo ok 3;;
+*)     echo bad 3;;
+esac
+
+case "$@" in
+*\:*)  echo bad 4;;
+*)     echo ok 4;;
+esac
+
+IFS=$' \t\n'
+
+bar=${*}
+foo=$*
+echo foo = "$foo"
+echo bar = "$bar"
+
+foo1=$@
+bar1=${@}
+
+echo foo1 = "$foo1"
+echo bar1 = "$bar1"
+
+foo2="$*"
+bar2="${*}"
+
+echo foo2 = "$foo2"
+echo bar2 = "$bar2"
+
+eval foo3='$*' bar3='${*}'
+echo foo3 = "$foo3"
+echo bar3 = "$bar3"
+
+case $* in
+*\ *)  echo ok 1;;
+*)     echo bad 1;;
+esac
+
+case $@ in
+*\ *)  echo ok 2;;
+*)     echo bad 2;;
+esac
+
+case "$*" in
+*\ *)  echo ok 3;;
+*)     echo bad 3;;
+esac
+
+case "$@" in
+*\ *)  echo ok 4;;
+*)     echo bad 4;;
+esac
+
+# tests for special expansion of "$*" and "${array[*]}" when used with other
+# expansions -- bugs through bash-2.05b
+${THIS_SH} ./dollar-star1.sub
+
+# tests for expansion of "$@" on rhs of things like ${param:+word}.  Bugs
+# though bash-2.05b
+${THIS_SH} ./dollar-at1.sub
+
+# tests for expansion of other variables in double-quoted strings containing
+# $@.  Bugs through bash-2.05b
+${THIS_SH} ./dollar-at2.sub
+
+# tests for various expansions of $* in different contexts -- word split,
+# no splitting, etc. when $IFS is NUL
+${THIS_SH} ./dollar-star2.sub
+
+exit 0