Browse Source

Correctly parsing JSON return for upload.sh

master
Brett Bohnenkamper 4 years ago
parent
commit
5e00b3301f
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      Upload/upload.sh

+ 2
- 1
Upload/upload.sh View File

@@ -14,11 +14,12 @@ else
for i in "$@"; do
printf "\nUploading file #${n} ... "
out=$(curl -sf -F file="@${i}" https://api.teknik.io/v1/Upload)
echo "${out}"
if [[ "${out}" =~ "error" ]]; then
printf 'error uploading file!\n'
exit 1
else
out="${out##*name\":\"}"
out="${out##*Name\":\"}"
out="${out%%\"*}"
printf "uploaded! Your file can be found at https://u.teknik.io/${out}\n"
fi

Loading…
Cancel
Save