Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

scp-to-http.sh: Replace HTTPPATH with MOVEPATH.

Instead of changing the uploaded HTTP path allow moving the file.
  • Loading branch information...
commit cd327634dac12c4aab8b7e9894b329f8041bf4aa 1 parent eac9bb7
@mikemcquaid authored
Showing with 11 additions and 18 deletions.
  1. +11 −18 scp-to-http.sh
View
29 scp-to-http.sh
@@ -8,31 +8,24 @@ if [ -z "$5" ]
then
FILEPATH="$4"
else
- HTTPPATH="$4"
+ MOVEPATH="$4"
FILEPATH="$5"
fi
FILENAME=$(basename "$FILEPATH")
HTTPFILE=${FILENAME//" "/"%20"}
-
-if [ -z "$HTTPPATH" ]
-then
- HTTP="http://$UPLOADHOST/~$USER/$HTTPFILE"
-else
- HTTP="$HTTPPATH/$HTTPFILE"
-fi
+HTTP="http://$UPLOADHOST/~$USER/$HTTPFILE"
SCP="$USER@$UPLOADHOST:$WWWDIR/"
scp "$FILEPATH" "$SCP"
-if [ $? -ne 0 ]
-then
- echo "$FILEPATH failed to upload to $SCP"
-else
- echo "$FILEPATH uploaded to $HTTP"
+[ $? -ne 0 ] && echo "$FILEPATH failed to upload to $SCP" && exit 1
+
+echo "$FILEPATH uploaded to $HTTP"
- if [ $OSX ]
- then
- echo $HTTP | pbcopy
- echo "URL copied to clipboard."
- fi
+if [ $OSX ]
+then
+ echo $HTTP | pbcopy
+ echo "URL copied to clipboard."
fi
+
+[ -n "$MOVEPATH" ] && mv -v "$FILEPATH" "$MOVEPATH"
Please sign in to comment.
Something went wrong with that request. Please try again.