From 4ed4ffce0f68137976b1ba77a352d0ce482592e4 Mon Sep 17 00:00:00 2001 From: relthyg Date: Thu, 31 May 2018 15:07:15 +0200 Subject: [PATCH 1/2] Add missing exit codes --- stravaup | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/stravaup b/stravaup index a380276..2187b7f 100755 --- a/stravaup +++ b/stravaup @@ -16,7 +16,7 @@ if [ ! -f "${HOME}/.stravauprc" ]; then echo "and register your own application to get a client id. Then create a file ~/.stravauprc containing" echo " STRAVAUP_CLIENT_ID = [insert your own]" echo " STRAVAUP_CLIENT_SECRET = [insert your own]" - exit + exit 1 fi source "${HOME}/.stravauprc" @@ -55,7 +55,7 @@ fi # Test whether file exists if [ ! -f "$1" ]; then echo "$1: no such file exists!" - exit + exit 1 fi # Get authorization code @@ -76,4 +76,7 @@ if [ "$TOKEN" = "" ]; then fi # Upload file -curl -X POST https://www.strava.com/api/v3/uploads -H "Authorization: Bearer $TOKEN" -F file=@"$1" -F data_type="$datatype" +curl -X POST https://www.strava.com/api/v3/uploads -H "Authorization: Bearer $TOKEN" -F file=@"$1" -F data_type="$datatype" || exit 1 + +exit 0 + From 2906ee58b07c8ce2ec64fcb5a1e09ae9b5f26ed9 Mon Sep 17 00:00:00 2001 From: relthyg Date: Thu, 31 May 2018 15:07:47 +0200 Subject: [PATCH 2/2] Set interpreter directive to /bin/bash. Use bash instead of sh, as "source" may not be found otherwise. --- stravaup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stravaup b/stravaup index 2187b7f..89f66b9 100755 --- a/stravaup +++ b/stravaup @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Command line interface for uploading to Strava.com #