16 lines
349 B
Bash
16 lines
349 B
Bash
|
|
#!/bin/bash
|
||
|
|
|
||
|
|
#
|
||
|
|
# A directory we want to create if it doesn't exist
|
||
|
|
#
|
||
|
|
BASEDIR="/tmp/testdir"
|
||
|
|
|
||
|
|
#
|
||
|
|
# Check for the existence of the directory and create it if not found
|
||
|
|
#
|
||
|
|
if [[ ! -d "$BASEDIR" ]]; then
|
||
|
|
# Create directory and take action on failure
|
||
|
|
mkdir "$BASEDIR" || { echo "Failed to create $BASEDIR"; exit 1; }
|
||
|
|
echo "Created $BASEDIR"
|
||
|
|
fi
|