addressed issue 48 (MKDIR_PROMPT ignored)

r819 mostly replaced directory_checks() and ck_dir() with dir_init() but
forgot about the MKDIR_PROMPT variable used in ck_dir(). So again wrapped
the prompting in a conditional based on that setting and moved the
action outside the conditional.
This commit is contained in:
slakmagik 2010-12-02 00:49:26 +00:00
parent dac7bd21c9
commit f17e5ae404

View File

@ -283,6 +283,7 @@ dir_init() {
fi
done
if [[ ${DI_OUTPUT[*]} ]]; then
if [[ $MKDIR_PROMPT ]]; then
# Keep DI_OUTPUT_LINES and the 'table headers' aligned, too.
cat << EOF
@ -303,13 +304,7 @@ EOF
while :; do
read $NFLAG -ep "(C)reate or (A)bort?: "
case $REPLY in
C|c)
if ! mkdir -p $DIRS2MK 2>/dev/null; then
echo "$SCRIPT: failed to create directories" >&2
exit 1
fi
break
;;
C|c) break ;;
A|a)
if [[ ${FUNCNAME[1]} == main ]]; then
exit 1
@ -321,6 +316,11 @@ EOF
esac
done
fi
if ! mkdir -p $DIRS2MK 2>/dev/null; then
echo "$SCRIPT: failed to create directories" >&2
exit 1
fi
fi
for ((i=0; i<${#DIR_VARS[*]}; i++)); do
if [ ! -w ${DIR_VARS[$i]} ]; then