Skip to content
Snippets Groups Projects
Unverified Commit f9b8b95e authored by Michael Aaron Murphy's avatar Michael Aaron Murphy Committed by GitHub
Browse files

Merge pull request #675 from aimof/remove-test-dep

Change: remove tests dependency
parents 34be5bd7 baf61eb3
No related branches found
No related tags found
No related merge requests found
for script in examples/a* examples/b*
for script in examples/script_exec/a* examples/script_exec/b*
target/debug/ion $script
end
\ No newline at end of file
end
echo @split("onetwoone", "two")
echo @split_at("onetwoone", "3")
echo @graphemes("onetwo", "3")
echo @bytes("onetwo")
echo @chars("onetwo")
echo @lines($unescape("firstline\nsecondline"))
echo @reverse([1 2 3])
echo @reverse(["a"])
let foo = [1 2 3]
echo @reverse(@foo)
one one
one twoone
o n e t w o
111 110 101 116 119 111
o n e t w o
firstline secondline
3 2 1
a
3 2 1
# Standard Arrays
let array = [1 [2 3] 4 [5 6]]
for i in @array
echo $i
end
for i in [1 [2 3] 4 [5 6]]
echo $i
end
# Array Command Substitution
let array_process = [ @(echo a b c d e) ]
for i in @array_process
echo $i
end
for i in @(echo a b c d e)
echo $i
end
# Array Concatenation
let new_array = [@array @array_process]
for i in @new_array
echo $i
end
# As Command Arguments
echo @array
echo @array_process
echo @new_array
# Slice by ID
let array = [ 1 2 3 ]
echo @array[0]
echo @array[1]
echo @array[2]
echo [ 1 2 3 ][0]
echo [ 1 2 3 ][1]
echo [ 1 2 3 ][2]
echo @(echo 1 2 3)[0]
echo @(echo 1 2 3)[1]
echo @(echo 1 2 3)[2]
# Slice by Range
let array = [ 1 2 3 4 5 ]
echo @array[0..1]
echo @array[0...1]
echo @array[..3]
echo @array[3..]
echo @array[..]
# Slice Syntax w/ variables
for index in 0..3
echo $(echo 😉😉😉)[$index]
end
# Convert Array to String
let array = [ 1 2 3 4 5 ]
let as_string = @array
echo $as_string
1
2
3
4
5
6
1
2
3
4
5
6
a
b
c
d
e
a
b
c
d
e
1
2
3
4
5
6
a
b
c
d
e
1 2 3 4 5 6
a b c d e
1 2 3 4 5 6 a b c d e
1
2
3
1
2
3
1
2
3
1
1 2
1 2 3
4 5
1 2 3 4 5
😉
😉
😉
1 2 3 4 5
if test 3 -eq 3
echo pass
else
echo fail
end
pass
# nested braces
echo 1{A{1,2},B{1,2}}
# permutating braces
echo {0,1}abc{2,3,4}def{5,6,7}{g,h,i}
# inclusive ranges
echo {-1...1}
echo {2...0}
echo {a...c}
echo {d...b}
echo {A...C}
echo {D...B}
# exclusive ranges
echo {-1..2}
echo {2..-1}
echo {a..d}
echo {d..a}
echo {A..D}
echo {D..A}
# inclusive stepped ranges
echo {0..2...4}
echo {a..2...e}
echo {A..2...E}
echo {0..-2...-4}
echo {e..-2...a}
echo {E..-2...A}
# exclusive stepped ranges
echo {0..2..5}
echo {a..2..f}
echo {A..2..F}
echo {0..-2..-5}
echo {e..-2..a}
echo {E..-2..A}
\ No newline at end of file
1A1 1A2 1B1 1B2
0abc2def5g 0abc2def5h 0abc2def5i 0abc2def6g 0abc2def6h 0abc2def6i 0abc2def7g 0abc2def7h 0abc2def7i 0abc3def5g 0abc3def5h 0abc3def5i 0abc3def6g 0abc3def6h 0abc3def6i 0abc3def7g 0abc3def7h 0abc3def7i 0abc4def5g 0abc4def5h 0abc4def5i 0abc4def6g 0abc4def6h 0abc4def6i 0abc4def7g 0abc4def7h 0abc4def7i 1abc2def5g 1abc2def5h 1abc2def5i 1abc2def6g 1abc2def6h 1abc2def6i 1abc2def7g 1abc2def7h 1abc2def7i 1abc3def5g 1abc3def5h 1abc3def5i 1abc3def6g 1abc3def6h 1abc3def6i 1abc3def7g 1abc3def7h 1abc3def7i 1abc4def5g 1abc4def5h 1abc4def5i 1abc4def6g 1abc4def6h 1abc4def6i 1abc4def7g 1abc4def7h 1abc4def7i
-1 0 1
2 1 0
a b c
d c b
A B C
D C B
-1 0 1
2 1 0
a b c
d c b
A B C
D C B
0 2 4
a c e
A C E
0 -2 -4
e c a
E C A
0 2 4
a c e
A C E
0 -2 -4
e c
E C
for i in 1..10
echo $i
if test $i -eq 5
break
end
end
let a = 1
while test $a -lt 10
echo $a
if test $a -eq 5
break
end
let a += 1
end
1
2
3
4
5
1
2
3
4
5
matches Foo '([A-Z])\w+' && echo true
matches foo '([A-Z])\w+' || echo false
echo foo | cat
read foo <<< $(echo bar)
echo $foo
true
false
foo
bar
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment