From: Michael Prokop Date: Thu, 19 Nov 2015 14:47:07 +0000 (+0100) Subject: Don't use working directory when --output-directory option is used X-Git-Tag: v0.12.0~1 X-Git-Url: http://git.grml.org/?p=grml-hwinfo.git;a=commitdiff_plain;h=5afa0d80a53a44fdb30a3e2ba43fb4df02ab7632 Don't use working directory when --output-directory option is used Otherwise when running something like: /root/system-info/grml-hwinfo --output-directory=/root/system-info/grml-hwinfo-data via cron this store data to /root/root/system-info/grml-hwinfo-data (instead of the requested /root/system-info/grml-hwinfo-data) since /root is the working directory for cron. --- diff --git a/grml-hwinfo b/grml-hwinfo index 48b9676..75567b2 100755 --- a/grml-hwinfo +++ b/grml-hwinfo @@ -112,7 +112,12 @@ fi # Generate output/temporary directory name & path, and output file path [ -n "$OUTDIRNAME" ] || OUTDIRNAME="grml-hwinfo-${DATE}" -OUTDIR="${WORKING_DIR}/${OUTDIRNAME}" +if $_opt_output_directory ; then + OUTDIR="${OUTDIRNAME}" +else + OUTDIR="${WORKING_DIR}/${OUTDIRNAME}" +fi + if $_opt_force ; then mkdir -p "${OUTDIR}" else