Skip to content
Snippets Groups Projects
Commit b7340c5e authored by Michael Aaron Murphy's avatar Michael Aaron Murphy
Browse files

Update Readme

parent b98b1c3f
No related branches found
No related tags found
No related merge requests found
...@@ -96,15 +96,33 @@ command arg1 arg2 arg3 ...@@ -96,15 +96,33 @@ command arg1 arg2 arg3
command arg1 arg2 arg3; command arg1 arg2 arg3; command arg1 arg2 arg3 command arg1 arg2 arg3; command arg1 arg2 arg3; command arg1 arg2 arg3
``` ```
### Pipelines & Redirections ### Piping & Redirecting Standard Output
It's currently only possible to pipe and redirect the standard output of one command to another command. The pipe (`|`) and redirect (`>`) operators are used for manipulating the standard output.
```ion ```ion
command arg1 | other_command | another_command arg2 command arg1 | other_command | another_command arg2
command arg1 > file command arg1 > file
``` ```
### Piping & Redirecting Standard Error
The `^|` and `^>` operators are used for manipulating the standard error.
```ion
command arg1 ^| other_command # Not supported yet
command arg1 ^> file
```
### Piping & Redirecting Both Standard Output & Standard Error
The `&|` and `&>` operators are used for manipulating both the standard output and error.
```ion
command arg1 &| other_command # Not supported yet
command arg1 &> file
```
### Conditional Operators ### Conditional Operators
The Ion shell supports the `&&` and `||` operators in the same manner as the Bash shell. The `&&` operator The Ion shell supports the `&&` and `||` operators in the same manner as the Bash shell. The `&&` operator
...@@ -146,7 +164,8 @@ end ...@@ -146,7 +164,8 @@ end
### For Loops ### For Loops
For loops, on the other hand, will take a variable followed by a list of values or a range expression, and For loops, on the other hand, will take a variable followed by a list of values or a range expression, and
iterate through all contained statements until all values have been exhausted. iterate through all contained statements until all values have been exhausted. If the variable is `_`, it
will be ignored.
```ion ```ion
# Obtaining Values From a Subshell # Obtaining Values From a Subshell
...@@ -168,6 +187,11 @@ end ...@@ -168,6 +187,11 @@ end
for a in 1...10 for a in 1...10
echo $a echo $a
end end
# Ignore Value
for _ in 1..10
do_something
end
``` ```
### Functions ### Functions
...@@ -183,7 +207,7 @@ fn fib n ...@@ -183,7 +207,7 @@ fn fib n
else else
let output = 1 let output = 1
let previous = 1 let previous = 1
for index in 2..$n for _ in 2..$n
let temp = $output let temp = $output
let output += $previous let output += $previous
let previous = $temp let previous = $temp
...@@ -196,3 +220,11 @@ for i in 1..20 ...@@ -196,3 +220,11 @@ for i in 1..20
fib $i fib $i
end end
``` ```
### Brace Expansion
It is possible to perform brace expansions within the Ion shell. Currently, only permutation braces are supported.
```ion
echo abc{1,2,3}def{456,789,101112}
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment