Fast way to share text from commandline

If you want to share text you can do it with https://hastebin.com and then inside your .bash-aliases or similar define a function like

export HASTE_SERVER=https://hastebin.com


haste () {                                                                                                                              
        a=$(cat)                                                                                                                        
        curl -X POST -s -d "$a" $HASTE_SERVER/documents | awk -F '"' -v haste_server=$HASTE_SERVER '{ print haste_server"/"$4 }'
} 

If you want to share somefile from commandline with

cat somefile | haste

and it will respond with e.g

https://hastebin.com/ibejajiful.bash

that points to the shared text from somefile. To get text down into a localfile again do

curl https://hastebin.com/raw/ibejajiful > somefile

and your have a local version of that file.

Notice that you should not share important information with this tool as it is not secure.

Skriv et svar

Dette site anvender Akismet til at reducere spam. Læs om hvordan din kommentar bliver behandlet.