diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-04 12:03:49 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-04 12:03:49 +1200 |
commit | 2c52d419be368c4d9e8e97ca67299ece9e23331b (patch) | |
tree | 85a8d963f72f16f5636a7aa1b4a406050f3c60c5 | |
parent | Change igex(1) into POSIX sh, simplify (diff) | |
download | dotfiles-2c52d419be368c4d9e8e97ca67299ece9e23331b.tar.gz dotfiles-2c52d419be368c4d9e8e97ca67299ece9e23331b.zip |
Make mktd(1) call in rndl(1) only if needed
-rwxr-xr-x | bin/rndl | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,13 +1,13 @@ #!/bin/sh # Print a random line from input -td= -cleanup() { - rm -fr -- "$td" -} -for sig in EXIT HUP INT TERM ; do - trap cleanup "$sig" -done if [ "$#" -eq 0 ] ; then + td= + cleanup() { + rm -fr -- "$td" + } + for sig in EXIT HUP INT TERM ; do + trap cleanup "$sig" + done td=$(mktd rndl) || exit set -- "$td"/stdin cat >"$td"/stdin |