Dropbox Uploader is a BASH script which can be used to upload, download, list or delete files from Dropbox, an online file sharing, synchronization and backup service.
Made the code more readable with the new syntax and fixed some variable declarations that should follow variable scope. Also removed unnecessary semicolons in code and formatting the code indention in beautiful way.
eg:
$? == 0 (BAD)
$? -eq 0 (GOOD)
$? != 0 (BAD)
$? -ne 0 (GOOD)
BAD:
function ansure_accesstoken () {
local NOW = date +%s
}
GOOD:
ansure_accesstoken () {
local now = $(date +%s)
}
BAD:
let NUMBEROFCHUNK=($FILE_SIZE/1024/1024+$CHUNK_SIZE-1)/$CHUNK_SIZE
eg:
$? == 0 (BAD) $? -eq 0 (GOOD)
$? != 0 (BAD) $? -ne 0 (GOOD)
BAD:
function ansure_accesstoken () { local NOW =
date +%s
}GOOD:
ansure_accesstoken () { local now = $(date +%s) }
BAD:
let NUMBEROFCHUNK=($FILE_SIZE/1024/1024+$CHUNK_SIZE-1)/$CHUNK_SIZE
GOOD:
((number_of_chunk = (file_size / 1024 / 1024 + CHUNK_SIZE - 1) / CHUNK_SIZE))
Add little more test for config file before source it to prevent error
Fixed return code when calling check_http_response function, it did not have an argument of '$?' at the end.
Fixed typo