It's too complicated,
rm -rf
is often overkill and a risky default,
exit
in a function that doesn't run in a subshell exits the caller,
bash doesn't have a ternary conditional operator no matter how much some people want it to,
--
should probably appear as an argument before
"$dir_name"
in the
rm
and
mkdir
commands, and in my personal opinion it is much nicer to write
&&
or
||
at the end of a line than use a backslash.