Why Sponsor Oils? | source | all docs for version 0.20.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 special variables for OSH and YSH.
Replacement for "$@"
TODO
The directory the current script resides in. This knows about 3 situations:
oshrc in an interactive shellosh myscript.shsource builtinIt's useful for "relative imports".
_statusAn Int that's set by the try builtin.
try {
ls /bad # exits with status 2
}
if (_status !== 0) { # _status is 2
echo 'failed'
}
_errorA Dict that's set by the try builtin when catching certain errors.
Such errors include JSON/J8 encoding/decoding errors, and user errors from the
error builtin.
try {
echo $[toJ8( /d+/ )] # invalid Eggex type
}
echo "failed: $[_error.message]" # => failed: Can't serialize ...
_pipeline_statusAlias for PIPESTATUS.
_process_sub_statusThe exit status of all the process subs in the last command.
YSH read sets this:
read --line < myfile
read --all < myfile
OILS_VERSIONThe version of Oils that's being run, e.g. 0.9.0.
OILS_GC_THRESHOLDAt a GC point, if there are more than this number of live objects, collect garbage.
OILS_GC_ON_EXITSet OILS_GC_ON_EXIT=1 to explicitly collect and free() before the process
exits. By default, we let the OS clean up.
Useful for ASAN testing.
OILS_GC_STATSWhen the shell process exists, print GC stats to stderr.
OILS_GC_STATS_FDWhen the shell process exists, print GC stats to this file descriptor.
Used for word splitting. And the builtin shSplit() function.
TODO: bash compat
TODO: bash compat
bash compat: serialized options for the set builtin.
bash compat: serialized options for the shopt builtin.
$HOME is used for:
Note: The shell doesn't set $HOME. According to POSIX, the program that invokes the login shell sets it based on /etc/passwd.
A colon-separated string that's used to find executables to run.
Result of regex evaluation [[ $x =~ $pat ]].
Exit code of each element in a pipeline.
TODO
TODO
An array of words, split by : and = for compatibility with bash. New completion scripts should use COMP_ARGV instead.
Discouraged; for compatibility with bash.
Discouraged; for compatibility with bash.
Discouraged; for compatibility with bash.
User-defined completion functions should Fill this array with candidates. It is cleared on every completion request.
An array of partial command arguments to complete. Preferred over COMP_WORDS. The compadjust builtin uses this variable.
(An OSH extension to bash.)
Override the default OSH history location.
Override the default YSH history location.
OSH read sets this:
read < myfile
bash compat
bash compat