From f843a771fad8086c7dd6c5b13bf0481b29bf919c Mon Sep 17 00:00:00 2001 From: Jens Kuehnel Date: May 15 2018 16:13:28 +0000 Subject: fix all cacertdir_rehash problem from shellcheck --- diff --git a/cacertdir_rehash b/cacertdir_rehash index 28c5075..68d8ab3 100755 --- a/cacertdir_rehash +++ b/cacertdir_rehash @@ -2,34 +2,34 @@ # create hash links on all files in the specified directory # -if [ -z "$1" -o ! -d "$1" ] ; then +if [ -z "$1" ] || [ ! -d "$1" ] ; then echo "'$1' must be a directory." >&2 exit 1 fi -if ! cd $1 ; then +if ! cd "$1" ; then echo "Cannot change cwd to $1" >&2 exit 2 fi # remove old links for i in ????????.* ; do - if [ -h $i ] ; then - rm -f $i + if [ -h "$i" ] ; then + rm -f "$i" fi done # create new links for i in * ; do - if [ -r $i -a ! -d $i ] ; then - hash=$(openssl x509 -hash -noout -in $i 2>/dev/null) + if [ -r "$i" ] && [ ! -d "$i" ] ; then + hash=$(openssl x509 -hash -noout -in "$i" 2>/dev/null) if [ -z "$hash" ] ; then continue fi suffix=0 - while [ -e $hash.$suffix ] ; do + while [ -e "$hash.$suffix" ] ; do suffix=$((suffix + 1)) done - ln -sf $i $hash.$suffix + ln -sf "$i" "$hash.$suffix" fi done