mirror of
https://github.com/notwa/rc
synced 2024-11-05 04:29:03 -08:00
automatically detect which of the four main shells that sh
is
This commit is contained in:
parent
28b4942252
commit
de4c5ec593
1 changed files with 11 additions and 1 deletions
12
sh/recombine
12
sh/recombine
|
@ -23,12 +23,22 @@ case "$sh" in
|
|||
(osh) SH=OSH c=osh;;
|
||||
(posh) SH=POSH c=posh;;
|
||||
(yash) SH=YASH c=yash;;
|
||||
(zsh) SH=ZSH c=zsh; set -o SH_WORD_SPLIT;;
|
||||
(zsh) SH=ZSH c=zsh;;
|
||||
(sh)
|
||||
f() { ! return 1; }
|
||||
g() { return 256; }
|
||||
if f; then # (ash, hush) || (zsh)
|
||||
g && SH=ASH c=ash || SH=ZSH c=zsh
|
||||
else # (bash, mksh, osh) || (dash, ksh, loksh, oksh, posh, yash)
|
||||
g && SH=BASH c=bash || SH=DASH c=dash
|
||||
fi;;
|
||||
(*)
|
||||
printf >&2 %s\\n "unknown shell (\$0): $0"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
[ "$SH" != zsh ] || set -o SH_WORD_SPLIT
|
||||
|
||||
printf %s\\n '#!/usr/bin/env false' '[ -n "$preload" ] || exit 1' ''
|
||||
for f in "${HOME:?}/sh"/*; do
|
||||
[ -n "${f##*.*}" ] && [ -f "$f" ] || continue
|
||||
|
|
Loading…
Reference in a new issue