From 89135abc09b42228d065ce37a94d61e7ee34e14a Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Mon, 22 Jul 2024 05:52:19 -0700 Subject: [PATCH] add a bunch more shells to the compatibility table --- sh/arrays | 2 +- tableize | 28 ++++++++++++++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/sh/arrays b/sh/arrays index 6d8e7e3..1645fb4 100644 --- a/sh/arrays +++ b/sh/arrays @@ -1,5 +1,5 @@ #!/usr/bin/env false -# compat: -ash +bash -dash +zsh +# compat: -ash +bash -dash -hush +ksh +mksh -oksh +osh -posh +yash +zsh whoa=( -Wall diff --git a/tableize b/tableize index 40fe191..f77b139 100755 --- a/tableize +++ b/tableize @@ -12,8 +12,8 @@ tableize() { # the script column has to be stupid wide because names are repeated twice for anchors. # column lengths: 45, 10, 4, 4, 4, 4 - printf '%s\n' '| script | preference | zsh | bash | dash | ash |' - printf '%s\n' '| --------------------------------------------- | ---------- | ---- | ---- | ---- | ---- |' + printf '%s\n' '| script | preference | ash | bash | dash | ksh | mksh | oksh | osh | posh | yash | zsh |' + printf '%s\n' '| --------------------------------------------- | ---------- | --- | ---- | ---- | --- | ---- | ---- | --- | ---- | ---- | --- |' local f= for f in sh/*; do @@ -25,7 +25,7 @@ tableize() { [ "$fn" = "${fn#_}" ] || continue # completion files [ "$fn" = "${fn%.bak}" ] || continue # backup files - local i=0 zsh= bash= dash= ash= pref= + local i=0 ash= bash= dash= ksh= mksh= oksh= osh= posh= yash= zsh= pref= while IFS= read -r line; do : $((i+=1)) [ $i -le 10 ] || break # act like head -n10 @@ -73,14 +73,26 @@ tableize() { (NO_DASH) dash=no;; (NO_ASH) ash=no;; (compat:) check=1;; - (+ash) [ "$check" = 0 ] || ash=yes;; + (+ash) [ "$check" = 0 ] || ash=yes;; (+bash) [ "$check" = 0 ] || bash=yes;; (+dash) [ "$check" = 0 ] || dash=yes;; - (+zsh) [ "$check" = 0 ] || zsh=yes;; - (-ash) [ "$check" = 0 ] || ash=no;; + (+ksh) [ "$check" = 0 ] || ksh=yes;; + (+mksh) [ "$check" = 0 ] || mksh=yes;; + (+oksh) [ "$check" = 0 ] || oksh=yes;; + (+osh) [ "$check" = 0 ] || osh=yes;; + (+posh) [ "$check" = 0 ] || posh=yes;; + (+yash) [ "$check" = 0 ] || yash=yes;; + (+zsh) [ "$check" = 0 ] || zsh=yes;; + (-ash) [ "$check" = 0 ] || ash=no;; (-bash) [ "$check" = 0 ] || bash=no;; (-dash) [ "$check" = 0 ] || dash=no;; - (-zsh) [ "$check" = 0 ] || zsh=no;; + (-ksh) [ "$check" = 0 ] || ksh=no;; + (-mksh) [ "$check" = 0 ] || mksh=no;; + (-oksh) [ "$check" = 0 ] || oksh=no;; + (-osh) [ "$check" = 0 ] || osh=no;; + (-posh) [ "$check" = 0 ] || posh=no;; + (-yash) [ "$check" = 0 ] || yash=no;; + (-zsh) [ "$check" = 0 ] || zsh=no;; ('#'*) break;; esac done done < "$f" @@ -108,7 +120,7 @@ tableize() { [ -n "$p" ] && printf '| %10s ' "$p" || printf '| %9s%s ' '' "$huh" local t= - for t in "$zsh" "$bash" "$dash" "$ash"; do + for t in "$ash" "$bash" "$dash" "$ksh" "$mksh" "$oksh" "$osh" "$posh" "$yash" "$zsh"; do local w="$huh" [ "$pref" != perl ] || w="$etc" [ "$t" != yes ] || w="$yay"