why does this simple program give such a weird output? The Next CEO of Stack OverflowSimple...

If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?

Is it convenient to ask the journal's editor for two additional days to complete a review?

How to invert MapIndexed on a ragged structure? How to construct a tree from rules?

What flight has the highest ratio of timezone difference to flight time?

Writing differences on a blackboard

How to avoid supervisors with prejudiced views?

How to get from Geneva Airport to Metabief, Doubs, France by public transport?

0-rank tensor vs vector in 1D

Where do students learn to solve polynomial equations these days?

How to check if all elements of 1 list are in the *same quantity* and in any order, in the list2?

Why do airplanes bank sharply to the right after air-to-air refueling?

Why is information "lost" when it got into a black hole?

Why, when going from special to general relativity, do we just replace partial derivatives with covariant derivatives?

Would a completely good Muggle be able to use a wand?

Which one is the true statement?

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

Yu-Gi-Oh cards in Python 3

What steps are necessary to read a Modern SSD in Medieval Europe?

Is French Guiana a (hard) EU border?

What connection does MS Office have to Netscape Navigator?

Does increasing your ability score affect your main stat?

Are police here, aren't itthey?

Is wanting to ask what to write an indication that you need to change your story?

What is meant by "large scale tonal organization?"



why does this simple program give such a weird output?



The Next CEO of Stack OverflowSimple desktop program instantly closesWhy does this script work in the current directory but fail when placed in the path?Why does this bash script not work?Weird output by declare and arrayWhy I obtain this error when I try to perform this simple bash script?run bash script from another script and redirect its outputWhy does my terminal look like this?why this shell script program is not workingWhy does this cronjob not work?Why does Bash output / is a directory?












0















I've just started learning how to use arrays so sorry if the answer is somehow obvious. I made a simple program which i thought would just count normally. The output of this program ended up being not only backwards at first but very strange. the program is:



#!/bin/bash
num=1
declare -A A1
while true
do

A1[$(($num + 1))]=$num
num=$(( $num + 1 ))
e=0
for e in ${A1[@]}
do
echo $e
done
echo "e is $e"
echo "num is $num"
sleep 0.1
done


but it's output was started doing some really weird stuff after 8 as shown here:



1
e is 1
num is 2
2
1
e is 1
num is 3
3
2
1
e is 1
num is 4
4
3
2
1
e is 1
num is 5
5
4
3
2
1
e is 1
num is 6
6
5
4
3
2
1
e is 1
num is 7
7
6
5
4
3
2
1
e is 1
num is 8
8
7
6
5
4
3
2
1
e is 1
num is 9
8
7
6
5
4
3
2
1
9
e is 9
num is 10
8
7
6
5
4
3
2
1
9
10
e is 10
num is 11
8
7
6
5
4
3
2
1
11
9
10
e is 10
num is 12
8
7
6
5
4
3
2
1
11
12
9
10
e is 10
num is 13
8
7
6
5
4
3
2
1
11
12
9
10
13
e is 13
num is 14
8
7
6
5
4
3
2
1
11
12
9
10
13
14
e is 14
num is 15
8
7
6
5
4
3
2
1
11
12
9
10
15
13
14
e is 14
num is 16
8
7
6
5
4
3
2
1
11
12
9
10
15
16
13
14
e is 14
num is 17
8
7
6
5
4
3
2
1
17
11
12
9
10
15
16
13
14
e is 14
num is 18
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
e is 14
num is 19
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
19
e is 19
num is 20
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
20
19
e is 19
num is 21
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
21
20
19
e is 19
num is 22
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
22
21
20
19
e is 19
num is 23
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
23
22
21
20
19
e is 19
num is 24
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
24
23
22
21
20
19
e is 19
num is 25
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
25
24
23
22
21
20
19
e is 19
num is 26
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
e is 19
num is 27
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
27
e is 27
num is 28
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
e is 27
num is 29
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
29
e is 29
num is 30
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
29
30
e is 30
num is 31
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
29
30
31
e is 31
num is 32
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
29
30
31
32
e is 32
num is 33
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
33
29
30
31
32
e is 32
num is 34
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
33
34
29
30
31
32
e is 32
num is 35
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
33
34
35
29
30
31
32
e is 32
num is 36
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
33
34
35
36
29
30
31
32
e is 32
num is 37
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
33
34
35
36
29
30
31
32
37
e is 37
num is 38
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
33
34
35
36
29
30
31
32
37
38
e is 38
num is 39
39
8
7
6
5
4
3
2
1
17
18
11
12
9
10
15
16
13
14
26
25
24
23
22
21
20
19
28
27
33
34
35
36
29
30
31
32
37
38
e is 38
num is 40
^C


can anybody explain this?










share|improve this question





























    0















    I've just started learning how to use arrays so sorry if the answer is somehow obvious. I made a simple program which i thought would just count normally. The output of this program ended up being not only backwards at first but very strange. the program is:



    #!/bin/bash
    num=1
    declare -A A1
    while true
    do

    A1[$(($num + 1))]=$num
    num=$(( $num + 1 ))
    e=0
    for e in ${A1[@]}
    do
    echo $e
    done
    echo "e is $e"
    echo "num is $num"
    sleep 0.1
    done


    but it's output was started doing some really weird stuff after 8 as shown here:



    1
    e is 1
    num is 2
    2
    1
    e is 1
    num is 3
    3
    2
    1
    e is 1
    num is 4
    4
    3
    2
    1
    e is 1
    num is 5
    5
    4
    3
    2
    1
    e is 1
    num is 6
    6
    5
    4
    3
    2
    1
    e is 1
    num is 7
    7
    6
    5
    4
    3
    2
    1
    e is 1
    num is 8
    8
    7
    6
    5
    4
    3
    2
    1
    e is 1
    num is 9
    8
    7
    6
    5
    4
    3
    2
    1
    9
    e is 9
    num is 10
    8
    7
    6
    5
    4
    3
    2
    1
    9
    10
    e is 10
    num is 11
    8
    7
    6
    5
    4
    3
    2
    1
    11
    9
    10
    e is 10
    num is 12
    8
    7
    6
    5
    4
    3
    2
    1
    11
    12
    9
    10
    e is 10
    num is 13
    8
    7
    6
    5
    4
    3
    2
    1
    11
    12
    9
    10
    13
    e is 13
    num is 14
    8
    7
    6
    5
    4
    3
    2
    1
    11
    12
    9
    10
    13
    14
    e is 14
    num is 15
    8
    7
    6
    5
    4
    3
    2
    1
    11
    12
    9
    10
    15
    13
    14
    e is 14
    num is 16
    8
    7
    6
    5
    4
    3
    2
    1
    11
    12
    9
    10
    15
    16
    13
    14
    e is 14
    num is 17
    8
    7
    6
    5
    4
    3
    2
    1
    17
    11
    12
    9
    10
    15
    16
    13
    14
    e is 14
    num is 18
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    e is 14
    num is 19
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    19
    e is 19
    num is 20
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    20
    19
    e is 19
    num is 21
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    21
    20
    19
    e is 19
    num is 22
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    22
    21
    20
    19
    e is 19
    num is 23
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    23
    22
    21
    20
    19
    e is 19
    num is 24
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    24
    23
    22
    21
    20
    19
    e is 19
    num is 25
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    25
    24
    23
    22
    21
    20
    19
    e is 19
    num is 26
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    e is 19
    num is 27
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    27
    e is 27
    num is 28
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    e is 27
    num is 29
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    29
    e is 29
    num is 30
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    29
    30
    e is 30
    num is 31
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    29
    30
    31
    e is 31
    num is 32
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    29
    30
    31
    32
    e is 32
    num is 33
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    33
    29
    30
    31
    32
    e is 32
    num is 34
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    33
    34
    29
    30
    31
    32
    e is 32
    num is 35
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    33
    34
    35
    29
    30
    31
    32
    e is 32
    num is 36
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    33
    34
    35
    36
    29
    30
    31
    32
    e is 32
    num is 37
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    33
    34
    35
    36
    29
    30
    31
    32
    37
    e is 37
    num is 38
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    33
    34
    35
    36
    29
    30
    31
    32
    37
    38
    e is 38
    num is 39
    39
    8
    7
    6
    5
    4
    3
    2
    1
    17
    18
    11
    12
    9
    10
    15
    16
    13
    14
    26
    25
    24
    23
    22
    21
    20
    19
    28
    27
    33
    34
    35
    36
    29
    30
    31
    32
    37
    38
    e is 38
    num is 40
    ^C


    can anybody explain this?










    share|improve this question



























      0












      0








      0








      I've just started learning how to use arrays so sorry if the answer is somehow obvious. I made a simple program which i thought would just count normally. The output of this program ended up being not only backwards at first but very strange. the program is:



      #!/bin/bash
      num=1
      declare -A A1
      while true
      do

      A1[$(($num + 1))]=$num
      num=$(( $num + 1 ))
      e=0
      for e in ${A1[@]}
      do
      echo $e
      done
      echo "e is $e"
      echo "num is $num"
      sleep 0.1
      done


      but it's output was started doing some really weird stuff after 8 as shown here:



      1
      e is 1
      num is 2
      2
      1
      e is 1
      num is 3
      3
      2
      1
      e is 1
      num is 4
      4
      3
      2
      1
      e is 1
      num is 5
      5
      4
      3
      2
      1
      e is 1
      num is 6
      6
      5
      4
      3
      2
      1
      e is 1
      num is 7
      7
      6
      5
      4
      3
      2
      1
      e is 1
      num is 8
      8
      7
      6
      5
      4
      3
      2
      1
      e is 1
      num is 9
      8
      7
      6
      5
      4
      3
      2
      1
      9
      e is 9
      num is 10
      8
      7
      6
      5
      4
      3
      2
      1
      9
      10
      e is 10
      num is 11
      8
      7
      6
      5
      4
      3
      2
      1
      11
      9
      10
      e is 10
      num is 12
      8
      7
      6
      5
      4
      3
      2
      1
      11
      12
      9
      10
      e is 10
      num is 13
      8
      7
      6
      5
      4
      3
      2
      1
      11
      12
      9
      10
      13
      e is 13
      num is 14
      8
      7
      6
      5
      4
      3
      2
      1
      11
      12
      9
      10
      13
      14
      e is 14
      num is 15
      8
      7
      6
      5
      4
      3
      2
      1
      11
      12
      9
      10
      15
      13
      14
      e is 14
      num is 16
      8
      7
      6
      5
      4
      3
      2
      1
      11
      12
      9
      10
      15
      16
      13
      14
      e is 14
      num is 17
      8
      7
      6
      5
      4
      3
      2
      1
      17
      11
      12
      9
      10
      15
      16
      13
      14
      e is 14
      num is 18
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      e is 14
      num is 19
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      19
      e is 19
      num is 20
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      20
      19
      e is 19
      num is 21
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      21
      20
      19
      e is 19
      num is 22
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      22
      21
      20
      19
      e is 19
      num is 23
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      23
      22
      21
      20
      19
      e is 19
      num is 24
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      24
      23
      22
      21
      20
      19
      e is 19
      num is 25
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      25
      24
      23
      22
      21
      20
      19
      e is 19
      num is 26
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      e is 19
      num is 27
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      27
      e is 27
      num is 28
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      e is 27
      num is 29
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      29
      e is 29
      num is 30
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      29
      30
      e is 30
      num is 31
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      29
      30
      31
      e is 31
      num is 32
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      29
      30
      31
      32
      e is 32
      num is 33
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      29
      30
      31
      32
      e is 32
      num is 34
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      29
      30
      31
      32
      e is 32
      num is 35
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      35
      29
      30
      31
      32
      e is 32
      num is 36
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      35
      36
      29
      30
      31
      32
      e is 32
      num is 37
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      35
      36
      29
      30
      31
      32
      37
      e is 37
      num is 38
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      35
      36
      29
      30
      31
      32
      37
      38
      e is 38
      num is 39
      39
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      35
      36
      29
      30
      31
      32
      37
      38
      e is 38
      num is 40
      ^C


      can anybody explain this?










      share|improve this question
















      I've just started learning how to use arrays so sorry if the answer is somehow obvious. I made a simple program which i thought would just count normally. The output of this program ended up being not only backwards at first but very strange. the program is:



      #!/bin/bash
      num=1
      declare -A A1
      while true
      do

      A1[$(($num + 1))]=$num
      num=$(( $num + 1 ))
      e=0
      for e in ${A1[@]}
      do
      echo $e
      done
      echo "e is $e"
      echo "num is $num"
      sleep 0.1
      done


      but it's output was started doing some really weird stuff after 8 as shown here:



      1
      e is 1
      num is 2
      2
      1
      e is 1
      num is 3
      3
      2
      1
      e is 1
      num is 4
      4
      3
      2
      1
      e is 1
      num is 5
      5
      4
      3
      2
      1
      e is 1
      num is 6
      6
      5
      4
      3
      2
      1
      e is 1
      num is 7
      7
      6
      5
      4
      3
      2
      1
      e is 1
      num is 8
      8
      7
      6
      5
      4
      3
      2
      1
      e is 1
      num is 9
      8
      7
      6
      5
      4
      3
      2
      1
      9
      e is 9
      num is 10
      8
      7
      6
      5
      4
      3
      2
      1
      9
      10
      e is 10
      num is 11
      8
      7
      6
      5
      4
      3
      2
      1
      11
      9
      10
      e is 10
      num is 12
      8
      7
      6
      5
      4
      3
      2
      1
      11
      12
      9
      10
      e is 10
      num is 13
      8
      7
      6
      5
      4
      3
      2
      1
      11
      12
      9
      10
      13
      e is 13
      num is 14
      8
      7
      6
      5
      4
      3
      2
      1
      11
      12
      9
      10
      13
      14
      e is 14
      num is 15
      8
      7
      6
      5
      4
      3
      2
      1
      11
      12
      9
      10
      15
      13
      14
      e is 14
      num is 16
      8
      7
      6
      5
      4
      3
      2
      1
      11
      12
      9
      10
      15
      16
      13
      14
      e is 14
      num is 17
      8
      7
      6
      5
      4
      3
      2
      1
      17
      11
      12
      9
      10
      15
      16
      13
      14
      e is 14
      num is 18
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      e is 14
      num is 19
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      19
      e is 19
      num is 20
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      20
      19
      e is 19
      num is 21
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      21
      20
      19
      e is 19
      num is 22
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      22
      21
      20
      19
      e is 19
      num is 23
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      23
      22
      21
      20
      19
      e is 19
      num is 24
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      24
      23
      22
      21
      20
      19
      e is 19
      num is 25
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      25
      24
      23
      22
      21
      20
      19
      e is 19
      num is 26
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      e is 19
      num is 27
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      27
      e is 27
      num is 28
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      e is 27
      num is 29
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      29
      e is 29
      num is 30
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      29
      30
      e is 30
      num is 31
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      29
      30
      31
      e is 31
      num is 32
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      29
      30
      31
      32
      e is 32
      num is 33
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      29
      30
      31
      32
      e is 32
      num is 34
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      29
      30
      31
      32
      e is 32
      num is 35
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      35
      29
      30
      31
      32
      e is 32
      num is 36
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      35
      36
      29
      30
      31
      32
      e is 32
      num is 37
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      35
      36
      29
      30
      31
      32
      37
      e is 37
      num is 38
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      35
      36
      29
      30
      31
      32
      37
      38
      e is 38
      num is 39
      39
      8
      7
      6
      5
      4
      3
      2
      1
      17
      18
      11
      12
      9
      10
      15
      16
      13
      14
      26
      25
      24
      23
      22
      21
      20
      19
      28
      27
      33
      34
      35
      36
      29
      30
      31
      32
      37
      38
      e is 38
      num is 40
      ^C


      can anybody explain this?







      command-line bash scripts






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 4 mins ago







      TheRedStormer

















      asked 11 mins ago









      TheRedStormerTheRedStormer

      62




      62






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130065%2fwhy-does-this-simple-program-give-such-a-weird-output%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130065%2fwhy-does-this-simple-program-give-such-a-weird-output%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

          Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

          Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...