diff --git a/sh/sortip b/sh/sortip index c1130ca..56e60bd 100755 --- a/sh/sortip +++ b/sh/sortip @@ -1,8 +1,8 @@ #!/usr/bin/sh -# compat: +ash +bash +dash +zsh +# compat: +ash +bash +dash +hush +ksh +mksh +oksh +osh +posh +yash +zsh sortip() { ### @- sort lines numerically by IPv4 segments. - sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n "$@" + LC_ALL=C sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n "$@" } [ -n "${preload+-}" ] || sortip "$@" diff --git a/sh/subdue b/sh/subdue index 94031ac..2a5328d 100755 --- a/sh/subdue +++ b/sh/subdue @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# compat: +ash +bash +dash +zsh +# compat: +ash +bash +dash +hush -ksh +mksh -oksh +osh +posh +yash +zsh __subdue() { ### @subdue ### reconfigure your terminal's color scheme using a preset for [recolor.](#recolor) diff --git a/sh/sum b/sh/sum index 522ecd2..a6b6a5d 100755 --- a/sh/sum +++ b/sh/sum @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# compat: +ash +bash +dash +zsh +# compat: +ash +bash +dash +hush -ksh +mksh +oksh +osh +posh +yash +zsh sum() { ### @- ### compute the summation of its arguments without forking processes. diff --git a/sh/sv b/sh/sv index 44ef5c9..ba44d4a 100755 --- a/sh/sv +++ b/sh/sv @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# compat: +ash +bash +dash +zsh YES_BB_AWK +# compat: +ash +bash +dash +hush +ksh +mksh +oksh +osh +posh +yash +zsh YES_BB_AWK sv() { ### @- ### collect the lastmost value of every key. diff --git a/sh/trash b/sh/trash index ae73451..76ec0a4 100755 --- a/sh/trash +++ b/sh/trash @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# compat: +ash +bash +dash +zsh +# compat: +ash +bash +dash +hush +ksh +mksh +oksh +osh +posh +yash +zsh trash() { ### @- ### output a given number of bytes from `/dev/random`. diff --git a/sh/trunc b/sh/trunc index 8105bc1..9c59115 100755 --- a/sh/trunc +++ b/sh/trunc @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# compat: +ash +bash +dash +zsh YES_BB_AWK +# compat: +ash +bash +dash +hush +ksh +mksh +oksh +osh +posh +yash +zsh YES_BB_AWK trunc() { ### @- ### truncate text to fit within your terminal using the unicode character `…`. @@ -12,8 +12,8 @@ trunc() { ### @- ### ``` [ $# -le 1 ] || { printf "%s\n" "$0: too many arguments" >&2; return 1; } - COLUMNS=${COLUMNS:-$(tput cols)} - awk -vL=${1:-$COLUMNS} '{e=length()>L?"…":"";print substr($0,0,L-(e?1:0)) e}' + COLUMNS="${COLUMNS:-"$(tput cols)"}" + awk -vL="${1:-$COLUMNS}" '{e=length()>L?"…":"";print substr($0,0,L-(e?1:0)) e}' } [ -n "${preload+-}" ] || trunc "$@" diff --git a/sh/unarchive b/sh/unarchive index f58d5a0..2c62d57 100755 --- a/sh/unarchive +++ b/sh/unarchive @@ -1,5 +1,5 @@ #!/usr/bin/env zsh -# compat: -ash -bash -dash +zsh +# compat: -ash -bash -dash -hush -ksh -mksh -oksh -osh -posh -yash +zsh unarchive() { ### @- extract the contents of an archive file in one of many formats. ### borrowed from [prezto.](https://github.com/sorin-ionescu/prezto) diff --git a/sh/unwrap b/sh/unwrap index a9ab553..c171a91 100755 --- a/sh/unwrap +++ b/sh/unwrap @@ -1,8 +1,8 @@ #!/usr/bin/env sh -# compat: +ash +bash +dash +zsh +# compat: +ash +bash +dash +hush +ksh +mksh +oksh +osh +posh +yash +zsh unwrap() { ### @- join paragraphs into one line each. - awk '\''BEGIN{RS="\n\n";FS="\n"}{for(i=1;i<=NF;i++)printf "%s ",$i;print "\n"}'\' + awk 'BEGIN{RS="\n\n";FS="\n"}{for(i=1;i<=NF;i++)printf "%s ",$i;print "\n"}' } [ -n "${preload+-}" ] || unwrap "$@" diff --git a/sh/v_domap b/sh/v_domap index 227948a..e7e6879 100644 --- a/sh/v_domap +++ b/sh/v_domap @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# compat: +ash +bash +dash +zsh +# compat: +ash +bash +dash -hush -ksh +mksh -oksh +osh +posh +yash +zsh v_domap() { argc $# -eq 1 "$0" || return diff --git a/sh/v_lower b/sh/v_lower index 0479f99..c2b2e2e 100644 --- a/sh/v_lower +++ b/sh/v_lower @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# compat: +ash +bash +dash +zsh +# compat: +ash +bash +dash -hush -ksh +mksh -oksh +osh +posh +yash +zsh v_lower() { ### @- transform the contents of a variable to lowercase. argc $# -eq 1 "$0" || return diff --git a/sh/v_upper b/sh/v_upper index d787215..1641c86 100644 --- a/sh/v_upper +++ b/sh/v_upper @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# compat: +ash +bash +dash +zsh +# compat: +ash +bash +dash -hush -ksh +mksh -oksh +osh +posh +yash +zsh v_upper() { ### @- transform the contents of a variable to uppercase. argc $# -eq 1 "$0" || return diff --git a/sh/wat b/sh/wat index bfae5d3..010820b 100755 --- a/sh/wat +++ b/sh/wat @@ -1,5 +1,5 @@ #!/usr/bin/env zsh -# compat: -ash -bash -dash +zsh +# compat: -ash -bash -dash -hush -ksh -mksh -oksh -osh -posh -yash +zsh # wat - a better and recursive which/whence # via: https://leahneukirchen.org/dotfiles/tools.html diff --git a/sh/xxp b/sh/xxp index cea9b5b..5b603da 100755 --- a/sh/xxp +++ b/sh/xxp @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# compat: +ash +bash +dash +zsh +# compat: +ash +bash +dash +hush +ksh +mksh +oksh +osh +posh +yash +zsh xxp() { ### @- ### act like `xxd -p`, but nicely formatted.