-
-
Notifications
You must be signed in to change notification settings - Fork 162
OSH versus Oil
andychu edited this page Nov 23, 2021
·
27 revisions
Here is a short guide:
-
bin/osh
runs the OSH language, which is extremely compatible with POSIX shell and bash. It's designed to run existing scripts. -
bin/oil
runs the Oil language, a new shell language that's designed to be familiar to Python and JavaScript users. You can gracefully upgrade your shell scripts to it, or write brand new scripts in it.
But they actually run in the same binary and use the same parser and interpreter! bin/osh
and bin/oil
are symlinks (or one line "forwarding" scripts).
There are many global shell options like shopt --set parse_brace
that change OSH into Oil. Running bin/oil
is equivalent to running bin/osh
with the option group shopt --set oil:all
. See the full option list below.
(As of 11/2021, OSH is a lot more mature than Oil.)
For examples of the syntax, see The Simplest Explanation of Oil.
-
https://github.com/NixOS/rfcs/pull/99#issuecomment-962495958
- Four Features That Justify a New Unix Shell (OSH)
- Five Essential Features of the Oil Language (Oil, not done yet)
This command lets you see the difference between OSH and Oil in detail! -s
means that the option is set when running in Oil mode, and -u
means that it's unset.
$ oil -c 'shopt -p oil:all'
shopt -s command_sub_errexit
shopt -u dashglob
shopt -s errexit
shopt -u expand_aliases
shopt -s inherit_errexit
shopt -s nounset
shopt -s nullglob
shopt -s parse_amp
shopt -s parse_at
shopt -s parse_at_all
shopt -u parse_backslash
shopt -u parse_backticks
shopt -s parse_brace
shopt -u parse_dollar
shopt -s parse_equals
shopt -u parse_ignored
shopt -s parse_paren
shopt -s parse_raw_string
shopt -s parse_triple_quote
shopt -s pipefail
shopt -s process_sub_fail
shopt -u redefine_proc
shopt -s sigpipe_status_ok
shopt -s simple_echo
shopt -s simple_eval_builtin
shopt -s simple_test_builtin
shopt -s simple_word_eval
shopt -s strict_argv
shopt -s strict_arith
shopt -s strict_array
shopt -s strict_control_flow
shopt -s strict_errexit
shopt -s strict_glob
shopt -s strict_nameref
shopt -s strict_tilde
shopt -s strict_word_eval
shopt -u xtrace_details
shopt -s xtrace_rich