We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b867455 commit 8eb77fcCopy full SHA for 8eb77fc
bin/git-cp
@@ -38,13 +38,15 @@ else
38
exit 40
39
fi
40
41
- DESTINATION_DIR="$(dirname "$DESTINATION_FILENAME")"
+ if [[ "$DESTINATION_FILENAME" == */ ]]; then
42
+ echo 1>&2 "$DESTINATION_FILENAME is not a file path."
43
+ exit 80
44
+ fi
45
+ DESTINATION_DIR="${DESTINATION_FILENAME%/*}"
46
if [ ! -d "$DESTINATION_DIR" ]; then
- echo "Creating destination directory: $DESTINATION_DIR"
- mkdir -p "$DESTINATION_DIR"
- if [ $? -ne 0 ]; then
47
+ if ! mkdir -p "$DESTINATION_DIR"; then
48
echo 1>&2 "Failed to create destination directory: $DESTINATION_DIR"
- exit 80
49
+ exit 160
50
51
52
0 commit comments