forked from HPR/hpr_generator
		
	Fill out stub of make_working_dir function
This commit is contained in:
		| @@ -41,7 +41,21 @@ set -o nounset                              # Treat unset variables as an error | ||||
| #    PARAMETERS:   | ||||
| #       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  ---------------------------------------------------------------- | ||||
| #          NAME:  clean_working_dir | ||||
|   | ||||
		Reference in New Issue
	
	Block a user