From 5afa0d80a53a44fdb30a3e2ba43fb4df02ab7632 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 19 Nov 2015 15:47:07 +0100 Subject: [PATCH] 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. --- grml-hwinfo | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.1.4