1 |
|
2 | echo 'This is a shell script with OSH extensions!'
|
3 | echo
|
4 |
|
5 | var x = 1 + 2*3
|
6 |
|
7 | echo "x: $x"
|
8 |
|
9 | # NOTE: we will take over 'set'
|
10 | setvar x += 1
|
11 |
|
12 | echo "x: $x"
|
13 |
|
14 | var mylist = [1, 2, 3]
|
15 |
|
16 | var y = mylist[1] * 10
|
17 |
|
18 | echo "y: $y"
|
19 |
|
20 | var list2 = mylist ++ [4, 5]
|
21 |
|
22 | # TODO: $json(list) should print [1,2,3,4,5]?
|
23 | #echo $list2
|
24 |
|
25 | # This is a more explicit representation.
|
26 | pp cell list2
|
27 |
|
28 | str1='shell string' # traditinoal shell-style assignment
|
29 |
|
30 | # Oil assignment
|
31 | var str2 = "Oil string"
|
32 |
|
33 | var str3 = str1 ++ str2
|
34 |
|
35 | echo "str3 = $str3"
|
36 |
|
37 |
|
38 |
|
39 | #var f1 = 1.23
|
40 | #var f2 = 3.45
|
41 |
|
42 |
|
43 |
|
44 | # TODO:
|
45 | # - lexing
|
46 | # - single-quoted strings
|
47 | # - floats
|
48 | # - parsing
|
49 | # - dicts
|
50 | # - comments at end of line
|
51 | # - eval
|
52 | # - Mutate variables with 'setvar'
|
53 |
|