Search code examples
bashshellunixshqnx

QNX shell loop sequence


Both following examples work in modern Bash but don't work in different sh shells (like QNX shell).

$ for i in {1..3}; do echo $i; done
1
2
3

$ for i in $(seq 1 3); do echo $i; done
1
2
3

Is there any alternative method to produce same sequence in QNX shell?


Solution

  • I found a method which works in QNX shell:

    integer i=0
    while ((i<4)); do i=i+1; echo $i; done