dutchcoders / transfer.sh

Easy and fast file sharing from the command-line.
https://github.com/dutchcoders/transfer.sh
MIT License
15.25k stars 1.54k forks source link

Error: curl: no URL specified! #576

Closed adrianmihalko closed 1 year ago

adrianmihalko commented 1 year ago

On macOS 13.3 I added shell function to .zshrc:

~/Downloads$ cat .zshrc

transfer(){ if [ $# -eq 0 ];then echo "No arguments specified.\nUsage:\n transfer <file|directory>\n ... | transfer <file_name>">&2;return 1;fi;if tty -s;then 
file="$1";file_name=$(basename "$file");if [ ! -e "$file" ];then echo "$file: No such file or directory">&2;return 1;fi;if [ -d "$file" ];then file_name="$file_name.zip" 
,;(cd "$file"&&zip -r -q - .)|curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null,;else cat "$file"|curl --progress-bar --upload-file "-" 
"https://transfer.sh/$file_name"|tee /dev/null;fi;else file_name=$1;curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null;fi;} 

When trying to upload any file:

~/Downloads$ transfer AVRA23746510.pdf
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
transfer:3: no such file or directory: https://transfer.sh/AVRA23746510.pdf
aspacca commented 1 year ago

@adrianmihalko the entry in .zshrc should be a single line, you can copy it directly from https://github.com/dutchcoders/transfer.sh#add-this-to-bashrc-or-zshrc-or-its-equivalent

using the code you pasted, that spans multiple lines, I can reproduce your issue, but now with the single-line version

there's probably some problem in quoting or escaping in your version that I didn't debug