andreafabrizi / Dropbox-Uploader

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.
https://www.andreafabrizi.it/2016/01/01/Dropbox-Uploader/
GNU General Public License v3.0
6.57k stars 1.08k forks source link

Error on initial run #464

Closed Coolie1101 closed 5 years ago

Coolie1101 commented 5 years ago
pi@hassbian:~ $ ./dropbox_uploader.sh
/usr/bin/env: ‘bash\r’: No such file or directory

I know the file exist, and is being run from the correct location, so I did the following to investigate.

Syntax Test:

pi@hassbian:~ $ bash -n dropbox_uploader.sh
dropbox_uploader.sh: line 91: syntax error near unexpected token `$'in\r''
'ropbox_uploader.sh: line 91: `    case $opt in

Logic errors:

pi@hassbian:~ $ bash -x dropbox_uploader.sh
+ $'\r'
dropbox_uploader.sh: line 21: $'\r': command not found
+ CONFIG_FILE=$'/home/pi/.dropbox_uploader\r'
+ $'\r'
dropbox_uploader.sh: line 24: $'\r': command not found
+ CHUNK_SIZE=$'50\r'
+ $'\r'
dropbox_uploader.sh: line 29: $'\r': command not found
+ $'\r'
dropbox_uploader.sh: line 33: $'\r': command not found
+ TMP_DIR=$'/tmp\r'
+ DEBUG=$'0\r'
+ QUIET=$'0\r'
+ SHOW_PROGRESSBAR=$'0\r'
+ SKIP_EXISTING_FILES=$'0\r'
+ ERROR_STATUS=$'0\r'
' EXCLUDE='()
+ $'\r'
dropbox_uploader.sh: line 42: $'\r': command not found
+ API_LONGPOLL_FOLDER=$'https://notify.dropboxapi.com/2/files/list_folder/longpoll\r'
+ API_CHUNKED_UPLOAD_START_URL=$'https://content.dropboxapi.com/2/files/upload_session/start\r'
+ API_CHUNKED_UPLOAD_FINISH_URL=$'https://content.dropboxapi.com/2/files/upload_session/finish\r'
+ API_CHUNKED_UPLOAD_APPEND_URL=$'https://content.dropboxapi.com/2/files/upload_session/append_v2\r'
+ API_UPLOAD_URL=$'https://content.dropboxapi.com/2/files/upload\r'
+ API_DOWNLOAD_URL=$'https://content.dropboxapi.com/2/files/download\r'
+ API_DELETE_URL=$'https://api.dropboxapi.com/2/files/delete\r'
+ API_MOVE_URL=$'https://api.dropboxapi.com/2/files/move\r'
+ API_COPY_URL=$'https://api.dropboxapi.com/2/files/copy\r'
+ API_METADATA_URL=$'https://api.dropboxapi.com/2/files/get_metadata\r'
+ API_LIST_FOLDER_URL=$'https://api.dropboxapi.com/2/files/list_folder\r'
+ API_LIST_FOLDER_CONTINUE_URL=$'https://api.dropboxapi.com/2/files/list_folder/continue\r'
+ API_ACCOUNT_INFO_URL=$'https://api.dropboxapi.com/2/users/get_current_account\r'
+ API_ACCOUNT_SPACE_URL=$'https://api.dropboxapi.com/2/users/get_space_usage\r'
+ API_MKDIR_URL=$'https://api.dropboxapi.com/2/files/create_folder\r'
+ API_SHARE_URL=$'https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings\r'
+ API_SHARE_LIST=$'https://api.dropboxapi.com/2/sharing/list_shared_links\r'
+ API_SAVEURL_URL=$'https://api.dropboxapi.com/2/files/save_url\r'
+ API_SAVEURL_JOBSTATUS_URL=$'https://api.dropboxapi.com/2/files/save_url/check_job_status\r'
+ API_SEARCH_URL=$'https://api.dropboxapi.com/2/files/search\r'
+ APP_CREATE_URL=$'https://www.dropbox.com/developers/apps\r'
+ RESPONSE_FILE=$'/tmp\r/du_resp_24866\r'
+ CHUNK_FILE=$'/tmp\r/du_chunk_14960\r'
+ TEMP_FILE=$'/tmp\r/du_tmp_16606\r'
' BIN_DEPS='sed basename date grep stat dd mkdir
+ VERSION=$'1.0\r'
+ $'\r'
dropbox_uploader.sh: line 70: $'\r': command not found
+ umask $'077\r'
: octal number out of range1: umask: 077
+ $'\r'
dropbox_uploader.sh: line 72: $'\r': command not found
dropbox_uploader.sh: line 91: syntax error near unexpected token `$'in\r''
'ropbox_uploader.sh: line 91: `    case $opt in
MegaV0lt commented 5 years ago

Propably you have to convert the file from windows coding to linux. Use dos2unix ./dropbox_uploader.sh for example

Coolie1101 commented 5 years ago

Looks to be the case, after using wget, it worked.

Coolie1101 commented 5 years ago

On another note, how can I exclude all files with a particular extension?