1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/transfersh_ynh.git synced 2024-09-04 01:35:59 +02:00
transfersh_ynh/doc/ADMIN_fr.md

19 lines
1,007 B
Markdown
Raw Normal View History

2023-08-25 12:00:11 +02:00
# Utilisation de la fonction shell
### Ajouter un alias à `.bashrc` ou `.zshrc`
Copiez et collez cette fonction dans votre fichier `.bashrc` ou `.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://__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;}
```
Vous pouvez maintenant utiliser la fonction de transfert
```
$ transfer hello.txt
```
### Documentation et exemples
https://github.com/dutchcoders/transfer.sh/blob/main/examples.md