diff options
author | EuAndreh <eu@euandre.org> | 2023-02-23 06:51:54 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-02-23 07:17:52 -0300 |
commit | 562bda6e8bb2135792fe96795995e8f8c056dae3 (patch) | |
tree | 79a665c32c54b14e7d5e52d588f2ad57fe96d23d /bin | |
parent | bin/cl: Use uuid(1), tmpname(1) and mkstemp(1) from $PATH (diff) | |
download | dotfiles-562bda6e8bb2135792fe96795995e8f8c056dae3.tar.gz dotfiles-562bda6e8bb2135792fe96795995e8f8c056dae3.tar.xz |
bin/: Cleanup temp file before exit
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/archiveit | 1 | ||||
-rwxr-xr-x | bin/bins | 2 | ||||
-rwxr-xr-x | bin/cl | 11 | ||||
-rwxr-xr-x | bin/e | 1 | ||||
-rwxr-xr-x | bin/print | 1 | ||||
-rwxr-xr-x | bin/with-email | 1 | ||||
-rwxr-xr-x | bin/yt | 1 |
7 files changed, 13 insertions, 5 deletions
diff --git a/bin/archiveit b/bin/archiveit index da132d7..a7b5a08 100755 --- a/bin/archiveit +++ b/bin/archiveit @@ -90,6 +90,7 @@ QUERY="$( # Copy the database because it is locked. DB="$(mkstemp)" +trap 'rm -f "$DB"' EXIT cp ~/.mozilla/firefox/*.default/places.sqlite "$DB" cd ~/Documents/Archive/ @@ -76,7 +76,7 @@ IFS=: # shellcheck disable=2086 if stest -rdq -n "$F" $PATH; then T="$(mkstemp)" - trap 'rm -f $T' EXIT + trap 'rm -f "$T"' EXIT stest -lxf $PATH | sort -u > "$T" mv "$T" "$F" fi @@ -118,8 +118,10 @@ for flag in "$@"; do esac done -NO_RC=false SCRIPT="$(mkstemp)" +trap 'rm -f "$SCRIPT"' EXIT + +NO_RC=false LISP_CLI_RC="${XDG_CONFIG_HOME:-$HOME/.config}/lisp-cli/init.lisp" VERBOSE=false IMAGE='' @@ -188,6 +190,7 @@ if [ "$PRESERVE_ARGS" = false ]; then fi MAIN="$(mkstemp)" +trap 'rm -f "$MAIN"' EXIT if [ "$NO_RC" = false ] && [ -e "$LISP_CLI_RC" ]; then escape_name "$LISP_CLI_RC" > "$MAIN" fi @@ -245,7 +248,7 @@ case "$IMPL" in else set -x fi - exec clisp "$@" + clisp "$@" ;; clozure) set -- -l "$MAIN" "$@" @@ -260,7 +263,7 @@ case "$IMPL" in else set -x fi - exec ccl "$@" + ccl "$@" ;; cmucl) exit 4 @@ -289,7 +292,7 @@ case "$IMPL" in else set -x fi - exec sbcl "$@" + sbcl "$@" ;; *) printf 'Unsupported implementation: "%s".\n\n' "$IMPL" >&2 @@ -71,6 +71,7 @@ fi if [ ! -t 0 ]; then F="$(mkstemp)" + trap 'rm -f "$F"' EXIT cat > "$F" exec 0</dev/tty exec 3>&1 @@ -131,6 +131,7 @@ done shift $((OPTIND - 1)) NEWDIR="$(mkdtemp)" +trap 'rm -rf "$NEWDIR"' EXIT if [ -z "${1:-}" ]; then FILE="$NEWDIR"/STDIN cat - > "$FILE" diff --git a/bin/with-email b/bin/with-email index bd3ef96..02789e9 100755 --- a/bin/with-email +++ b/bin/with-email @@ -76,6 +76,7 @@ now() { } OUT="$(mkstemp)" +trap 'rm -f "$OUT"' EXIT { printf 'Running command: %s\n' "$*" printf 'Starting at: %s\n' "$(now)" @@ -87,6 +87,7 @@ fi if [ ! -e "$1" ]; then F="$(mkstemp)" + trap 'rm -f "$F"' EXIT printf '%s\n' "$1" > "$F" else F="$1" |