aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-01-13 20:18:22 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-01-13 20:18:22 +1300
commite79e53c707145f7a7bdd4ae1049b4bc6dcbf28b7 (patch)
tree14daff1819711bd53ddf03a935717d7a3e9c2219
parent21a37405d2fcc46908e37487f345dd6cdac20fa9 (diff)
downloaddotfiles-e79e53c707145f7a7bdd4ae1049b4bc6dcbf28b7.tar.gz
dotfiles-e79e53c707145f7a7bdd4ae1049b4bc6dcbf28b7.zip
Reimplement bl(1df) in Awk
This is shorter and tidier.
-rw-r--r--bin/bl.awk5
-rw-r--r--bin/bl.sh10
2 files changed, 5 insertions, 10 deletions
diff --git a/bin/bl.awk b/bin/bl.awk
new file mode 100644
index 00000000..0be2fc6e
--- /dev/null
+++ b/bin/bl.awk
@@ -0,0 +1,5 @@
+# Generate blank lines
+BEGIN {
+ while (ARGV[1]--)
+ print ""
+}
diff --git a/bin/bl.sh b/bin/bl.sh
deleted file mode 100644
index 6dd3d687..00000000
--- a/bin/bl.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-# Generate blank lines
-if [ "$#" -ne 1 ] || [ "$1" -lt 0 ] ; then
- printf >&2 'bl: Non-negative line count needed as sole argument\n'
- exit 2
-fi
-n=0
-while [ "$n" -lt "${1:-0}" ] ; do
- printf '\n'
- n=$((n+1))
-done