From 53c42a5d00d158000146c23da31532fc6240bd2d Mon Sep 17 00:00:00 2001 From: Stephen Gregoratto Date: Wed, 13 Mar 2019 11:29:11 +1100 Subject: [PATCH] change rotdir to use ed(1) --- .scripts/tools/rotdir | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.scripts/tools/rotdir b/.scripts/tools/rotdir index 50e1d84..2fabeda 100755 --- a/.scripts/tools/rotdir +++ b/.scripts/tools/rotdir @@ -1,3 +1,16 @@ #!/bin/sh -# Give this script a filename argument. Returns PWD rotated with that file first. -ls "$PWD" | awk "BEGIN { lines = \"\"; m = 0; } /^$1$/ { m = 1; } { if (!m) { if (lines) { lines = lines\"\n\"; } lines = lines\"\"\$0; } else { print \$0; } } END { print lines; }" +if [ -z "$1" ]; then + echo usage: rotdir regex 2>&1 + exit 1; +fi + +ed -s <