Skip to content

Commit

Permalink
Avoid using 'mktemp --suffix' as busybox does not support it
Browse files Browse the repository at this point in the history
  • Loading branch information
whoan committed Nov 9, 2019
1 parent 5b1497e commit 9fb6720
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions snip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ __snip__replace_snips() {
local extension="${filename#"$root_filename"}"

local prefix_tmp
prefix_tmp=$(command -p mktemp --suffix=-snip-) || return 1
prefix_tmp=$(command -p mktemp -t snip.XXXXXX) || return 1
# remove old snip tmp files and the one just created as we only need the file name.
# using --dry-run is unsafe. not doing so, we also test access to tmp filesystem. see man mktemp
rm "${prefix_tmp%/*}"/*-snip-*
rm "${prefix_tmp%/*}"/snip.*

local cache_dir=~/.cache/snip
mkdir -p "$cache_dir"/
Expand All @@ -131,7 +131,7 @@ __snip__replace_snips() {
source_file="$new_file"
done

local output_file=${prefix_tmp}output${extension}
local output_file=${prefix_tmp}-output${extension}
__snip__remove_snip_lines "$source_file" > "$output_file"
echo "$output_file"
}
Expand Down

0 comments on commit 9fb6720

Please sign in to comment.