aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-06-14 13:13:47 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-06-14 13:17:41 +1200
commit40de9a6c860631fcbc933228850f74d4aa367258 (patch)
tree28accae131b6e7907973007bfae2f59997d79b2d /bin
parentRefactor m4 macro names (diff)
downloaddotfiles-40de9a6c860631fcbc933228850f74d4aa367258.tar.gz
dotfiles-40de9a6c860631fcbc933228850f74d4aa367258.zip
Switch to using awk for line counting in dub(1df)
Seems a bit nicer, passing the variable in as data rather than code
Diffstat (limited to 'bin')
-rw-r--r--bin/dub.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/dub.sh b/bin/dub.sh
index c30749af..2dfd77f0 100644
--- a/bin/dub.sh
+++ b/bin/dub.sh
@@ -4,7 +4,7 @@ self=dub
# First optional argument is the directory, defaulting to the
# current dir; second optional argument is the number of files to
# show, defaulting to 20
-dir=${1:-.} lines=${2:-10}
+dir=${1:-.} lim=${2:-10}
# Enter the target dir or bail
cd -- "$dir" || exit
@@ -24,4 +24,4 @@ find . ! -name . -prune \( \
sort -k1,1nr |
# Limit the output to the given number of lines
-sed "$((lines))"q
+awk -v lim="$lim" 'NR<=lim'