Fill out stub of make_working_dir function

This commit is contained in:
Roan Horning 2023-02-27 23:27:26 -05:00
parent 0ed7efe93b
commit b544687f0f
Signed by: rho_n
GPG Key ID: 234AEF20B72D5769

View File

@ -41,7 +41,21 @@ set -o nounset # Treat unset variables as an error
# PARAMETERS: # PARAMETERS:
# RETURNS: The path to the working directory # RETURNS: The path to the working directory
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
function make_working_dir { echo; } function make_working_dir {
# the directory of the script
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"`
# check if tmp dir was created
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
echo "Could not create temp dir"
exit 1
fi
echo $WORK_DIR
}
#--- FUNCTION ---------------------------------------------------------------- #--- FUNCTION ----------------------------------------------------------------
# NAME: clean_working_dir # NAME: clean_working_dir