We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 94f0d4d commit 86a1acdCopy full SHA for 86a1acd
1 file changed
sync.sh
@@ -35,12 +35,18 @@ script_name="$(basename "${BASH_SOURCE[0]}")"
35
# Collect and validate absolute paths for each target.
36
targets=()
37
for t; do
38
- mkdir -p "$t" # create target if missing
39
- abs_t="$(cd "$t" && pwd -P)" # resolve to canonical absolute path
+ # Must already exist as a directory
+ if [[ ! -d $t ]]; then
40
+ echo "Error: '$t' does not exist or is not a directory" >&2
41
+ exit 1
42
+ fi
43
+
44
+ # resolve to canonical absolute path
45
+ abs_t="$(cd "$t" && pwd -P)"
46
47
# Guard against syncing into a sub-directory of the template itself.
48
if [[ $abs_t == "$script_dir"* ]]; then
- echo "Error: target $abs_t is inside template dir $script_dir" >&2
49
+ echo "Error: '$t' is inside template dir $script_dir" >&2
50
exit 1
51
fi
52
0 commit comments