aboutsummaryrefslogtreecommitdiff
path: root/bin/stws
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-03 21:21:52 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-03 21:21:52 +1200
commit86b3532b4584355b85998fddf1db0d995109ff12 (patch)
treeea7df77f73c1567419906999d9001b3ba81afbd6 /bin/stws
parentCorrect stbl(1) manual page (diff)
downloaddotfiles-86b3532b4584355b85998fddf1db0d995109ff12.tar.gz
dotfiles-86b3532b4584355b85998fddf1db0d995109ff12.zip
Add stws(1)
Diffstat (limited to 'bin/stws')
-rwxr-xr-xbin/stws11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/stws b/bin/stws
new file mode 100755
index 00000000..1514a979
--- /dev/null
+++ b/bin/stws
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Strip trailing spaces on one or more files
+if [ "$#" -eq 0 ] ; then
+ printf >&2 'tstf: Need filenames\n'
+fi
+for fn ; do
+ ed -s -- "$fn" <<'EOF'
+g/ *$/ s/ *$//
+w
+EOF
+done