tdenniston / bish

Bish is a language that compiles to Bash. It's designed to give shell scripting a more comfortable and modern feel.
MIT License
1.48k stars 36 forks source link

Translation error #21

Closed egorsmkv closed 9 years ago

egorsmkv commented 9 years ago

Bish-script:

def double(val) {
    return val * val;
}

for (i in 2 .. 4) {
    d = i * i;
    for (j in i .. d) {
        print(double(j/i+j*i));
    }
}

Bash-script:

#!/bin/bash
# ...

function bish_double () {
    echo $(($1 * $1)); exit;
}

function bish_main () {
    for i in $(seq 2 4); do
        d=$(($i * $i));
        for j in $(seq "$i" "$d"); do
            bish_print "$(bish_double $(($(($j / $i)) + $(($j * $i)))))";
        done;
}

    done;
}

function bish_print () {
    echo $1;
}

bish_main;
tdenniston commented 9 years ago

Can you verify that it is fixed? Then I can close it.

egorsmkv commented 9 years ago

@tdenniston Checked. Works without problems.