diff options
author | EuAndreh <eu@euandre.org> | 2024-05-09 09:16:29 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-05-09 09:16:29 -0300 |
commit | cb3e6e922465717e360cedbe80f2420cc50e397d (patch) | |
tree | a0e2abd36b11acef9bf6e230a3f69843a0a59595 /bin/tmpname | |
parent | bin/backup: Further simplify this backup script (diff) | |
download | dotfiles-cb3e6e922465717e360cedbe80f2420cc50e397d.tar.gz dotfiles-cb3e6e922465717e360cedbe80f2420cc50e397d.tar.xz |
bin/...: Move utilities to the dedicated "eut" package
Diffstat (limited to 'bin/tmpname')
-rwxr-xr-x | bin/tmpname | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/bin/tmpname b/bin/tmpname deleted file mode 100755 index f16816e..0000000 --- a/bin/tmpname +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - tmpname - tmpname -h - EOF -} - -help() { - cat <<-'EOF' - - - Options: - -h, --help show this message - - - Generate a temporary name. - - - Examples: - - Create a temporary file: - - $ OUT="$(tmpname)"; touch "$OUT"; cmd > "$OUT" - - - `cd` into a temporary directory: - - $ DIR="$(tmpname)"; mkdir -p "$DIR"; cd "$DIR" - EOF -} - - -for flag in "$@"; do - case "$flag" in - (--) - break - ;; - (--help) - usage - help - exit - ;; - (*) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - (h) - usage - help - exit - ;; - (*) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -printf '%s\n' "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)" |