Add a create_dir() shell function
This commit is contained in:
parent
709ae74194
commit
fd99c1ad3c
|
@ -219,7 +219,7 @@ link_file() {
|
||||||
eval $link_cmd 1>/dev/null
|
eval $link_cmd 1>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_file() {
|
setup_file() {
|
||||||
src=$1
|
src=$1
|
||||||
dest=$2
|
dest=$2
|
||||||
if [ ! -f $dest ]; then
|
if [ ! -f $dest ]; then
|
||||||
|
@ -229,13 +229,14 @@ function setup_file() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_dir() {
|
setup_dir() {
|
||||||
src=$1
|
src=$1
|
||||||
dest=$2
|
dest=$2
|
||||||
ignore_missing=$3
|
abort_if_src_not_found=$3
|
||||||
|
|
||||||
if [ ! -d $src ]; then
|
if [ ! -d $src ]; then
|
||||||
error "Source path '$src' doesn't exist!\n"
|
error "Source path '$src' doesn't exist!\n"
|
||||||
if [[ $ignore_missing != "1" ]]; then
|
if [[ $abort_if_src_not_found != "1" ]]; then
|
||||||
abort
|
abort
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
|
@ -248,3 +249,13 @@ function setup_dir() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_dir() {
|
||||||
|
path=$1
|
||||||
|
if [ -d $path ]; then
|
||||||
|
printf "${BOLD}${MAGENTA}==> ${NORMAL}${BOLD}${YELLOW}'$path'${NORMAL} already exists${NORMAL}\n"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
mkdir $path
|
||||||
|
printf "${BOLD}${GREEN}==> ${NORMAL}Created ${BOLD}${YELLOW}'$path'${NORMAL}\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user