#!/usr/bin/env false # FAKE_COMPAT cd ~/sh && unset IFS || exit case "$0" in (-*) sh="${0#-}";; (/*) sh="${0##*/}";; (*) sh="$0" esac [ "$sh" != recombine ] || sh=zsh # only zsh does this (AFAIK) case "$sh" in (ash) SH=ASH c=ash;; (bash) SH=BASH c=bash;; (dash) SH=DASH c=dash;; (hush) SH=HUSH c=hush;; (ksh) SH=KSH c=ksh;; (loksh) SH=OKSH c=oksh;; # similar enough to oksh to use the same compatibility flag (mksh) SH=MKSH c=mksh;; (oksh) SH=OKSH c=oksh;; (osh) SH=OSH c=osh;; (posh) SH=POSH c=posh;; (yash) SH=YASH c=yash;; (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 i=10 sh= while IFS= read -r line; do check=0 for word in $line; do case "$word" in (YES_$SH) sh=1;; (NO_$SH) sh=0;; (compat:) check=1;; esac [ "$check" != 1 ] || case "$word" in (+$c) sh=1;; (-$c) sh=0;; esac done [ "$((i-=1))" != 0 ] || break # act like head -n10 done < "$f" [ "$sh" != 1 ] || set -- "$@" "$f" done [ $# = 0 ] || cat "$@"