#!/usr/bin/env nix-shell #!nix-shell -i bash set -e dirpath="$1" if ! test -d "$dirpath" then # if the directory *doesn't* exist, try creating it # if we fail to create it, ensure we raced with something else and that it's actually a directory mkdir "$dirpath" || test -d "$dirpath" fi