Why Sponsor Oils? | source | all docs for version 0.21.0 | all versions | oilshell.org
Warning: Work in progress! Leave feedback on Zulip or Github if you'd like this doc to be updated.
This chapter in the Oils Reference describes the word language for OSH and YSH.
$'\n'
TODO: elaborate
YSH strings in the word language are the same as in the expression language.
See ysh-string in chap-expr-lang.
Triple-quoted in the word language are the same as in the expression language.
See triple-quoted in chap-expr-lang.
Not done.
Executes a command and captures its stdout.
OSH has shell-compatible command sub like $(echo hi)
. If a trailing newline
is returned, it's removed:
$ hostname
example.com
$ echo "/tmp/$(hostname)"
/tmp/example.com
YSH has spliced command subs, enabled by shopt --set parse_at
. The reuslt is
a List of strings, rather than a single string.
$ write -- @(echo foo; echo 'with spaces')
foo
with-spaces
The command's stdout parsed as the "J8 Lines" format, where each line is either:
""
or J8-style b'' u'' ''
)See J8 Notation for more details.
Evaluates to the value of a variable:
$ x=X
$ echo $x ${x}
X X
Shell has C-style arithmetic:
$ echo $(( 1 + 2*3 ))
7
Used as a shortcut for a user's home directory:
~/src # my home dir
~bob/src # user bob's home dir
${a[i+1]}
${x@P} evaluates x as a prompt string, e.g. the string that would be printed if PS1=$x.