Archived
4
2

Put variables into local scope of the function

Forgot to use the local keyword when declaring the variables.
This commit is contained in:
Roan Horning 2023-03-03 21:44:35 -05:00
parent a53f201842
commit 094287837c
Signed by: rho_n
GPG Key ID: 234AEF20B72D5769

View File

@ -44,13 +44,13 @@ set -o nounset # Treat unset variables as an error
function make_working_dir {
# the directory of the script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
local DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# the temp directory used, within $DIR
# omit the -p parameter to create a temporal directory in
# the default location
WORK_DIR=`mktemp -d -p "$DIR"`
local WORK_DIR=`mktemp -d -p "$DIR"`
# check if tmp dir was created
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then