~ubuntu-branches/ubuntu/trusty/bash/trusty-security

« back to all changes in this revision

Viewing changes to tests/arith6.sub

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-03-03 22:52:05 UTC
  • mfrom: (1.3.5) (2.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20140303225205-87ltrt5kspeq0g1b
Tags: 4.3-1ubuntu1
* Merge with Debian; remaining changes:
  - skel.bashrc:
    - Run lesspipe.
    - Enable ls aliases.
    - Set options in ll alias to -alF.
    - Define an alert alias.
    - Enabled colored grep aliases.
  - etc.bash.bashrc:
    - Add sudo hint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function reorder
 
2
{
 
3
        (( x[1] < x && (x=x[1], x[1]=$x) ))
 
4
        echo "${x[@]}"
 
5
}
 
6
 
 
7
x=(123 456)
 
8
reorder
 
9
x=(456 123)
 
10
reorder
 
11
 
 
12
unset x
 
13
unset -f reorder
 
14
 
 
15
function reorder
 
16
{
 
17
        (( x[1] < x[0] && (x=x[1], x[1]=$x) ))
 
18
        echo "${x[@]}"
 
19
}
 
20
 
 
21
x=(123 456)
 
22
reorder
 
23
x=(456 123)
 
24
reorder
 
25
 
 
26
unset x
 
27
unset -f reorder
 
28
 
 
29
function reorder
 
30
{
 
31
        (( x[1] < x[0] && (x[0]=x[1], x[1]=$x) ))
 
32
        echo "${x[@]}"
 
33
}
 
34
 
 
35
x=(123 456)
 
36
reorder
 
37
x=(456 123)
 
38
reorder
 
39
 
 
40
unset -f reorder
 
41
 
 
42
n=0 ; (( (a[n]=++n)<7&&a[0])); echo "${a[@]:1}"
 
43
 
 
44
n=0 a="(a[n]=++n)<7&&a[0]"; ((a[0])); echo "${a[@]:1}"
 
45
 
 
46
n=0 a="(a[n]=n++)<7&&a"; ((a)); echo "${a[@]:1}"
 
47
 
 
48
# bugs with lvalue caching and pointer aliasing through bash-4.2
 
49
echo $(( a=(y[0] + y[1]) & 0xff, b=(y[2] + y[3]) & 0xff, a << 8 | b))
 
50
echo $a, $b
 
51
((a = y[0], b = 1 ))
 
52
echo $a, $b