diff options
| author | EuAndreh <eu@euandre.org> | 2022-08-13 13:17:45 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2022-08-13 13:17:45 -0300 |
| commit | a2324725adab4fda610d39eb21d8d28bdf8f35ba (patch) | |
| tree | b8d770e51d7e0703020cfd6862e890b717bcb23e /bin/mkdtemp | |
| parent | bin/player: Add working utility (diff) | |
| download | dotfiles-a2324725adab4fda610d39eb21d8d28bdf8f35ba.tar.gz dotfiles-a2324725adab4fda610d39eb21d8d28bdf8f35ba.tar.xz | |
bin/: Add examples to help strings
Diffstat (limited to 'bin/mkdtemp')
| -rwxr-xr-x | bin/mkdtemp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/bin/mkdtemp b/bin/mkdtemp index d012175..3729dd4 100755 --- a/bin/mkdtemp +++ b/bin/mkdtemp @@ -15,10 +15,50 @@ help() { Options: -h, --help show this message + Create a new temporary file and echo its name back. + + + Examples: + + `cd` into temporary directory: + + $ cd "$(mkdtemp)" 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)) + + name="$(tmpname)" mkdir "$name" echo "$name" |
