summaryrefslogtreecommitdiff
path: root/optcvt.sh
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2011-02-26 16:45:20 +0100
committerHelmut Grohne <helmut@subdivi.de>2011-02-26 16:45:20 +0100
commit59321add23b651220292a42e50a81d9e812cce16 (patch)
tree29542aa09bf603744ec561f503398be3771210a3 /optcvt.sh
parent458ccd1cdc60c672537c5e5844bd49668a0d1e54 (diff)
downloadtcvt-59321add23b651220292a42e50a81d9e812cce16.tar.gz
added optcvt.sh
Executes tcvt iff the resulting width is at least 80 chars.
Diffstat (limited to 'optcvt.sh')
-rwxr-xr-xoptcvt.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/optcvt.sh b/optcvt.sh
new file mode 100755
index 0000000..2f3f89c
--- /dev/null
+++ b/optcvt.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+TCVT=./tcvt.py
+MINWIDTH=80
+
+SIZE=`stty size`
+test $? = 0 || exit $?
+COLUMNS="${SIZE#* }"
+
+if test "$COLUMNS" -ge $((2*$MINWIDTH+1)); then
+ exec $TCVT "$@"
+else
+ exec "$@"
+fi