diff options
| author | Alejandro Colomar <alx@kernel.org> | 2024-11-03 13:40:36 +0100 |
|---|---|---|
| committer | Alejandro Colomar <alx@kernel.org> | 2024-11-03 13:40:39 +0100 |
| commit | 9b3638d53a9151a3ccff5154146c623a53de64a6 (patch) | |
| tree | 39c22a90d8d5b9ac9af66326499d7aea1a18aae8 | |
| parent | e2f17db9b13159e647b161673ad753c9bdd2f0fc (diff) | |
| download | man-pages-9b3638d53a9151a3ccff5154146c623a53de64a6.tar.gz | |
src/bin/pdfman: Pipe to read(1) with lastpipe
This is more readable than nested command substitution. We already
require bash(1) for ${!#}, so we can abuse it a little bit more.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
| -rwxr-xr-x | src/bin/pdfman | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bin/pdfman b/src/bin/pdfman index edc3d1b932..0386b8efd8 100755 --- a/src/bin/pdfman +++ b/src/bin/pdfman @@ -4,8 +4,12 @@ # SPDX-License-Identifier: GPL-3.0-or-later set -Eeuo pipefail; +shopt -s lastpipe; -tmp="$(mktemp -t "$(printf '%s\n' "${!#}" | sed 's,.*/,,').XXXXXX")"; +printf '%s\n' "${!#}.XXXXXX" \ +| sed 's,.*/,,' \ +| xargs mktemp -t \ +| read -r tmp; man -Tpdf "$@" >"$tmp"; xdg-open "$tmp"; |
