source | all docs for version 0.9.9 | all versions | oilshell.org
Warning: Work in progress! Leave feedback on Zulip or Github if you'd like this doc to be updated.
This doc aims to help shell users understand Oil.
If you don't know shell, see A Tour of the Oil Language.
strict_* shell options to reduce edge cases. Oil generally
fails faster than shell.So Many Shell Constructs Are Deprecated/Discouraged.
All of this is discouraged in favor of Oil expressions:
[[ $x =~ $pat ]]x=$(( x + 1 )) and (( x = x + 1 )) and let, etc.declare -A assoc=(['k1']=v1 ['k2']=v2)For details on the expression language, see Oil's Expression Language (under construction).
See Oil Languages Idioms for more rewrites.
then fi and do donevar, const, setvar instead of builtins
like local, readonly, myvar=foo, etc.
var a = %(ale bean) instead of local a=(ale bean).fork and forkwait builtins instead of & and (). Parentheses are
generally used for Python-like expressions, e.g. if (x > 0) { echo 'positive' }See A Tour of Oil and Command Language for more details.
$[42 + a[i] + f(x)]echo $join(['pea', nut'])echo r'C:\Program Files\'See A Tour of Oil and Word Language for more details.
read --lineshvar, Registersshopt --set parse_braceIFS, _DIALECT_pipeline_status, _match(), etc.${.myproc arg1 $x} (TODO)Here's an incomplete list of bash features that are preserved:
$'line\n'{alice,bob}@example.comdiff <(sort left.txt) <(sort right.txt)