Skip to content

Commit

Permalink
Minor: Prefer $TMPDIR if set; use /tmp as fallback
Browse files Browse the repository at this point in the history
Co-authored-by: Edwin Kofler <[email protected]>
  • Loading branch information
inkarkat and hyperupcall authored Dec 29, 2024
1 parent 6598e46 commit 92124cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion todo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ sed() {
elif [ "$1" = '-i.bak' ]; then
shift
filepath=${!#}
filepath_temp=/tmp/todo.sh-sed.$RANDOM.$$
filepath_temp=${TMPDIR-/tmp}/todo.sh-sed.$RANDOM.$$
command sed "$@" > "$filepath_temp" && mv "$filepath_temp" "$filepath"
else
command sed "$@"
Expand Down

0 comments on commit 92124cb

Please sign in to comment.