yash
Configure
Section titled “Configure”- Consider removing
--disable-dirstackif required - Consider adding
--disable-testif thetestbuiltin is not required
- Check if we can replace
bashentirely even if we enable more features insidebash(will also requireyashnot going into POSIXly-correct mode when invoked assh)
Prepare
Section titled “Prepare”- Depends on
a2xandasciidoc - Depends on
netbsd-curses(libterminfo.soin particular) yashprovides its own command line editing librarylineeditand does not depend onlibeditorreadline(this means that the custom bindings under/etc/editrcwill not affectyash)installtarget copies whatever is undershare/toDESTDIRand we do not wantshare/completionas glaucus uses alternative software
Configure
Section titled “Configure”- All
--enable-*flags are already enabled by default (seeconfigure) --no-createis like a dry run that does not generate build filesdebugis set tofalseby default--disable-docremoves the need to depend ona2x--disable-helpprevents bothhelp $builtinand$builtin --helpfrom working- No need to set
YASH_GETCWD_AUTO_MALLOCasmuslhandlesgetcwdcorrectly --with-term-lib=terminfois the only required library to build and runyash(curses,ncurses,ncurseswandtinfoare not needed)
Package
Section titled “Package”defaultsourcessamplewhich sourcescommonyashloadsdefaultautomatically if no~/.yashrcis detectedshare/configis not needed as provide our owndefault
yashrc (or default)
Section titled “yashrc (or default)”clobberis enabled by default- glaucus builds
yashwith command history and line-editing support so it makes no sense to check if these are enabled or not HISTRMDUPcan be set to remove duplicate history items but it makes prediction less accurateMAILCHECK=0does not disable mail checking and instead checks before every prompt, alsounset MAILCHECKalone does not stopMAILfrom being setpipe-failis disabled by default (similar tobash)set --le-predict-emptyis counterintuitive: "${LANG:=C}"breaks yash with-yash: cannot read input: Invalid or incomplete multibyte or wide character, this happens as the previous copyright notice in theyashrc(ordefault) file included aUTF-8byte, which means thatyashhas to start withLANG=C.UTF-8orLANG=en_US.UTF-8before parsing that configuration fileYASH_PS1P='\fi.'dims predicted text\fi.can be combined with colors on modern terminals\fgi.(dimmed green) however this does not work in thetty- Prefer
forward-semiwordandbackward-semiwordto both theirbigwordandemacswordvariants - Prefer
backward-kill-semiwordtobackward-kill-bigwordto respect/and-in paths semiwordstops at punctuation- Blinking
\fn.breaks formatting in some environments - Do not export every variable as
yashrcshould respect whatever the user’s environment is (this isn’t a build script to force set the environment) - Do not run commands like
lognameoruname -ninsidePS1as they will run with every prompt (evaluate beforehand instead) - Do not use
set -o le-trim-rightas it breaks formatting echois a shell builtin and it can print both local and exported variables, whileenvis an external command that only shows exported variables- It is not possible to reset all
bindkeys and start from a clean state, so we keep things vanilla and only bind what is needed
- Can be cross-compiled properly now removing the need for
dashinchroot - Initialization scripts are executed only if
yashwas invoked in interactive mode - The POSIX standard deprecates combining options and arguments (
set -oerrexit) and any POSIX-conforming applications must separate themset -o errexit - When
yashis in interactive mode thevimode is automatically activated if the standard input and error are both connected to a terminal - The POSIXly-correct mode is automatically enabled when
yashis started assh set -o posixly-correctalso enables the POSIXly-correct modeset -oprints a list of shell options and their current valuessetaccepts options in long formatset --allexport, with-o/+o(set -o allexport) and as a single character (set -a)- Not all
setoptions can be specified as a single character - Long format is case-insensitive and irrelevant non-alphanumeric characters are ignored (
--le-comp-debugand--LeCompDebugare equivalent) - If
nois prepended to a long option, the meaning is reversed
References
Section titled “References”- https://diva-portal.org/smash/get/diva2:1985766/FULLTEXT01.pdf
- https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425
- https://github.com/carpentries-incubator/shell-extras/issues/30
- https://github.com/dylanaraps/pure-bash-bible
- https://github.com/dylanaraps/pure-sh-bible
- https://github.com/koalaman/shellcheck
- https://github.com/magicant/yash/issues/48
- https://github.com/magicant/yash/pull/203
- https://github.com/mgree/smoosh
- https://github.com/shellspec/shellbench
- https://grymoire.com/Unix/Quote.html
- https://grymoire.com/Unix/Sh.html
- https://magicant.github.io/yash/doc/
- https://news.ycombinator.com/item?id=13940322
- https://pubs.opengroup.org/onlinepubs/9799919799/idx/shell.html
- https://pubs.opengroup.org/onlinepubs/9799919799/utilities/sh.html
- https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html
- https://reddit.com/r/bash/comments/mivbcm/the_set_o_pipefail_is_not_a_best_practice/
- https://reddit.com/r/linux/comments/9yokuc/safer_bash_scripts_with_set_euxo_pipefail_options/
- https://reddit.com/r/programming/comments/1bvinup/avoid_set_o_pipefail_in_bash/
- https://shellhaters.org/
- https://steinbaugh.com/posts/posix.html
- https://www.etalabs.net/sh_tricks.html
- https://youtube.com/watch?v=9fSkygQ-ZjI