diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-10-19 15:16:14 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-10-19 15:16:14 +0200 |
commit | 1a6145ed267ef9e4db44282ca613abc992c0e359 (patch) | |
tree | 5a3182b6fd881138c8481a8889c7283edb24c6ad | |
parent | 466dd62ba30b8270379a79238bc85e21a75ebcbe (diff) | |
download | necho-1a6145ed267ef9e4db44282ca613abc992c0e359.tar.gz necho-1a6145ed267ef9e4db44282ca613abc992c0e359.tar.xz necho-1a6145ed267ef9e4db44282ca613abc992c0e359.zip |
add POSIX-shell reimplementations
These are not as nice as the C implementation, but may be much easier to install.
-rw-r--r-- | necho.sh | 15 |
1 files changed, 15 insertions, 0 deletions
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' +} |