commit fc6414a54387064dc56d337a9e7dd95303b88350 (patch)
parent d3196a6817cecb4894772eb5a3d87fa278d58f4d
Author: Alex Karle <alex@alexkarle.com>
Date: Sun, 4 Oct 2020 14:33:19 -0400
ed: Update `e` wrapper to fall-back if rlwrap not found
I'd like `e` to behave properly if `rlwrap` is not installed so that
I can use `e` regardless of whether I am able to install packages on
the system.
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/bin/e b/bin/e
@@ -1,5 +1,13 @@
#!/bin/sh
# e -- slightly improved ed(1) wrapper
+set -e
+
+# short circuit fallback to ed(1) if no rlwrap present
+if ! command -v rlwrap >/dev/null; then
+ echo "warning: rlwrap not found, falling back to regular ed" 1>&2
+ exec ed
+fi
+
for f in .tags tags; do
if [ -e "$f" ]; then
echo "using tags from ./$f"