updated text alias sample, changed sed regex to ._- from .-_ to prevent

range.
This commit is contained in:
Remco 2014-11-14 11:14:07 +01:00
parent 8b56d3bc15
commit 896579efee
4 changed files with 17 additions and 10 deletions

View file

@ -173,7 +173,9 @@
<span class="code-title"># Add this to .bashrc or its equivalent</span>
<br/>transfer() {
<br># write to output to tmpfile because of progress bar
<br>tmpfile=$( mktemp -t transferXXX ); basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9.-_]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; cat $tmpfile; rm -f $tmpfile;
<br>tmpfile=$( mktemp -t transferXXX ); basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
<br/>curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile
<br/>cat $tmpfile; rm -f $tmpfile;
<br/>}
<br/>
<br/>alias transfer=transfer

View file

@ -18,10 +18,10 @@ Add alias to .bashrc or .zshrc:
===
transfer() {
# write to output to tmpfile because of progress bar
tmpfile=$( mktemp -t transfer )
curl --progress-bar --upload-file $1 https://transfer.sh/$(basename $1) >> $tmpfile;
cat $tmpfile;
rm -f $tmpfile;
tmpfile=$( mktemp -t transferXXX );
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
cat $tmpfile; rm -f $tmpfile;
}
alias transfer=transfer

View file

@ -147,7 +147,9 @@ include "includes/head.html"
<span class="code-title"># Add this to .bashrc or its equivalent</span>
<br/>transfer() {
<br># write to output to tmpfile because of progress bar
<br>tmpfile=$( mktemp -t transferXXX ); basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9.-_]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; cat $tmpfile; rm -f $tmpfile;
<br>tmpfile=$( mktemp -t transferXXX ); basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
<br/>curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile
<br/>cat $tmpfile; rm -f $tmpfile;
<br/>}
<br/>
<br/>alias transfer=transfer

View file

@ -14,14 +14,17 @@ $ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt
Upload to virustotal:
$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal
Virusscan:
$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/scan
Add alias to .bashrc or .zshrc:
===
transfer() {
# write to output to tmpfile because of progress bar
tmpfile=$( mktemp -t transfer )
curl --progress-bar --upload-file $1 https://transfer.sh/$(basename $1) >> $tmpfile;
cat $tmpfile;
rm -f $tmpfile;
tmpfile=$( mktemp -t transferXXX );
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
cat $tmpfile; rm -f $tmpfile;
}
alias transfer=transfer