diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-31 14:19:57 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-31 14:29:17 +1300 |
commit | 0c84989ca0b97ca1d075e7a304a407553e34381d (patch) | |
tree | 2188a585aef6ed345b1c575da6f63445baabf522 /bin/fnp.sh | |
parent | Add clarifying comment (diff) | |
download | dotfiles-0c84989ca0b97ca1d075e7a304a407553e34381d.tar.gz dotfiles-0c84989ca0b97ca1d075e7a304a407553e34381d.zip |
Clarify control flow in shell scripts
Diffstat (limited to 'bin/fnp.sh')
-rw-r--r-- | bin/fnp.sh | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,7 +1,9 @@ # Print input, but include filenames as headings # Assume stdin if no options given -[ "$#" -gt 0 ] || set -- - +if [ "$#" -eq 0 ] ; then + set -- - +fi # Iterate through arguments for arg do @@ -13,7 +15,9 @@ for arg do *) fn=$arg ;; esac - [ -n "$tail" ] && printf '\n' + if [ -n "$tail" ] ; then + printf '\n' + fi tail=1 # Form the underline; is there a nicer way to do this in POSIX sh? |