commit c9eedbd59fab0bbcf685d5924d41be073d738622 (patch)
parent c4b49add960e6aa0d309e0705b37c0a731fdc772
Author: Alex Karle <alex@alexkarle.com>
Date: Wed, 30 Sep 2020 00:15:52 -0400
ed: Add BSD ed(1) support to `bed` wrapper
I prefer to use -v for verbose messages if I'm using a
version of ed that supports it (i.e. GNU ed). OpenBSD's
ed(1) does not, so we need to check if --version succeeds
first.
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/bin/bed b/bin/bed
@@ -9,9 +9,14 @@ done
export INPUTRC="$HOME/etc/edinputrc"
+# Only include -v if using GNU ed
+if ed --version >/dev/null 2>&1 ; then
+ VERBOSE="-v"
+fi
+
exec rlwrap \
--complete-filenames \
--logfile /tmp/rled.log \
--histsize 10000 $COMP \
--extra-char-after-completion '' \
- ed -v -p"> " "$@"
+ ed $VERBOSE -p"> " "$@"