From 1a6145ed267ef9e4db44282ca613abc992c0e359 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 19 Oct 2017 15:16:14 +0200 Subject: add POSIX-shell reimplementations These are not as nice as the C implementation, but may be much easier to install. --- necho.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 necho.sh diff --git a/necho.sh b/necho.sh new file mode 100644 index 0000000..c02d06e --- /dev/null +++ b/necho.sh @@ -0,0 +1,15 @@ +# POSIX sh implementations of necho and friends +# +# To the extent possible under law, the creator of this work has waived +# all copyright and related or neighboring rights to this work. +# http://creativecommons.org/publicdomain/zero/1.0/ + +necho() { for a; do printf '%s\n' "$a"; done; } +zecho() { for a; do printf '%s\0' "$a"; done; } +qecho() { for a; do printf '\302\273%s\302\253 ' "$a"; done; printf '\n'; } +jecho() { printf '%s' "$@"; } +secho() { + [ "$#" -ge 1 ] && { printf '%s' "$1"; shift; } + for a; do printf ' %s' "$a"; done + printf '\n' +} -- cgit 1.4.1