diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-06-14 13:13:47 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-06-14 13:17:41 +1200 |
commit | 40de9a6c860631fcbc933228850f74d4aa367258 (patch) | |
tree | 28accae131b6e7907973007bfae2f59997d79b2d | |
parent | Refactor m4 macro names (diff) | |
download | dotfiles-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
-rw-r--r-- | bin/dub.sh | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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' |