轻松使用transfer.sh从命令行共享文件 Easy file sharing from the command line using transfer.sh-rootopen.com

轻松使用transfer.sh从命令行共享文件

需要:curl xsel访问互联网(http://transfer.sh)
这是一个使用transfer.sh服务的别名,可以通过命令行轻松实现共享文件。
我修改了transfer.sh提供的别名,使用xsel将生成的URL复制到剪贴板。
完整的修改别名如下,因为commandline只允许255个字符:transfer(){if [$#-eq 0];
用法:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi  if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" |xsel --clipboard; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" |xsel --clipboard ; fi; xsel --clipboard; }

.

0

linux命令:transfer() { basefile=$(basename “$1” | sed -e ‘s/[^a-zA-Z0-9._-]/-/g’);curl –progress-bar –upload-file “$1” “https://transfer.sh/$basefile”|xsel –clipboard;xsel –clipboard ; } } ; –clipboard –clipboard;xsel “https://transfer.sh/$basefile”|xsel “$1” –upload-file –progress-bar ‘s/[^a-zA-Z0-9._-]/-/g’);curl -e sed | “$1” basefile=$(basename { transfer() transfer() { basefile=$(basename “$1” | sed -e ‘s/[^a-zA-Z0-9._-]/-/g’);curl –progress-bar –upload-file “$1” “https://transfer.sh/$basefile”|xsel –clipboard;xsel –clipboard ; }rootopen.com

gray 2018-03-13 17:27:48

输出