2022-06-25 13:37:10 +02:00
|
|
|
# Using the shell function
|
|
|
|
|
|
|
|
### Add alias to `.bashrc` or `.zshrc`
|
|
|
|
|
|
|
|
Copy and past this function into your `.bashrc` or `.zshrc` file.
|
|
|
|
|
|
|
|
```
|
2023-04-06 11:17:24 +02:00
|
|
|
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://__DOMAIN__/$file_name"|tee /dev/null,;else cat "$file"|curl --progress-bar --upload-file "-" "https://__DOMAIN__/$file_name"|tee /dev/null;fi;else file_name=$1;curl --progress-bar --upload-file "-" "https://__DOMAIN__/$file_name"|tee /dev/null;fi;}
|
2022-06-25 13:37:10 +02:00
|
|
|
```
|
|
|
|
Now you can use transfer function
|
|
|
|
|
|
|
|
```
|
|
|
|
$ transfer hello.txt
|
|
|
|
```
|
|
|
|
|
2022-06-25 13:43:24 +02:00
|
|
|
### How to
|
2022-06-25 13:37:10 +02:00
|
|
|
|
|
|
|
https://github.com/dutchcoders/transfer.sh/blob/main/examples.md
|