This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/dotfiles/scripts/create-script
2021-12-08 02:23:10 -03:00

26 lines
371 B
Bash
Executable file

#!/bin/sh
set -e
testz() {
if test -z "$1"; then
echo "$2" >&2
exit 1
fi
}
testz "$DOTDROP_CONFIG" "DOTDROP_CONFIG is not set"
testz "$1" "No script name provided"
DOTDIR="$(dirname "$DOTDROP_CONFIG")"
cd "$DOTDIR/dotfiles/scripts"
if ! test -f "$1"
then
pwd
touch "$1"
printf '#!/bin/sh\n' > "$1"
chmod u+x "$1"
fi
kak "$1"