From 50aedb15997bae463b6676c10c05ab1b0384563e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 7 Jun 2014 14:16:50 -0400 Subject: jh-checksource: small cleanups --- jh-checksource.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jh-checksource.sh b/jh-checksource.sh index c9d1086..e3eff21 100644 --- a/jh-checksource.sh +++ b/jh-checksource.sh @@ -15,7 +15,7 @@ safe_files_string=() min_size=3 normalize_filename() { - local cwd="`pwd`" + local cwd="$(readlink -m -- "$PWD")" readlink -m -- "$1"|sed "s|^$cwd/|./|" } @@ -43,7 +43,7 @@ matches_regexp() { print-human() { libremessages warning "The source directory %s contains binary files:" "$PWD" - sed 's/./ -> &/' + sed 's/^/ -> /' } print-machine() { @@ -61,9 +61,8 @@ main() { done # Init - local unsafe_files="$(mktemp)" - cleanup() { rm -f -- "$unsafe_files"; } - trap cleanup EXIT + local unsafe_files="$(mktemp --tmpdir "${0##*/}.XXXXXXXXXX")" + trap "$(printf 'rm -f -- %q' "$unsafe_files")" EXIT # Heavy lifting find . -type f -printf '%s %h/%f\n' | # find all files -- cgit v1.2.3-54-g00ecf