Skip to content

Commit

Permalink
Added Pastebin.com Bash Script
Browse files Browse the repository at this point in the history
  
    Usage : $0 [ -n <paste name> ] [ -e <paste email> ] [ -t <type of code> ] [ -h ]
   
    <paste name>   Specify the name of paste to be used (optional)
    <paste email>   Specify email to be used while pasting (optional)
    <type of code> Specify code language used, use any of the following values (optional and default value is plain text)

    => Some famous [ -t <type of code> ] Values::

    php - PHP
    actionscript3 - Action Script 3
    asp - ASP
    bash - BASH script
    c - C language
    csharp - C#
    cpp - C++ 
    java - JAVA
    sql - SQL

#pass stdin using | operator
michal@michal-N130:~$ cat bashcode.txt | ./pastebin -t bash
http://pastebin.com/93SuECwJ

#or you can just use command as below, paste code and then press ctrl + D to get the link
michal@michal-N130:~$ ./pastebin -n anil -t php
<?php
echo "Hey, this is a test";
?>
http://pastebin.com/xxxxxxxx

Pastebin bash script located in /usr/share/i-nex/pastebin
  • Loading branch information
eloaders committed Feb 12, 2012
1 parent d890068 commit 5121464
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions debian/install
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ src/i-nex/i-nex.gambas usr/bin
src/i-nex/logo/i-nex.0.4.x.png usr/share/pixmaps
debian/i-nex.desktop usr/share/applications
debian/check_kernel usr/bin
debian/pastebin usr/share/i-nex
69 changes: 69 additions & 0 deletions debian/pastebin
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
# Paste at Pastebin.com using command line (browsers are slow, right?)
# coder : Anil Dewani
# date : Novemeber 7, 2010

#help function
howto()
{
echo "\
Pastebin.com Bash Script \
Usage : $0 [ -n <paste name> ] [ -e <paste email> ] [ -t <type of code> ] [ -h ]
<paste name> Specify the name of paste to be used (optional)
<paste email> Specify email to be used while pasting (optional)
<type of code> Specify code language used, use any of the following values (optional and default value is plain text)
=> Some famous [ -t <type of code> ] Values::
php - PHP
actionscript3 - Action Script 3
asp - ASP
bash - BASH script
c - C language
csharp - C#
cpp - C++
java - JAVA
sql - SQL
"
}


NAME=
EMAIL=
TYPE=

#getopts, config
while getopts "n:e:t:h" OPTION
do
case $OPTION in
n)
NAME=$OPTARG
;;
e)
EMAIL=$OPTARG
;;
t)
TYPE=$OPTARG
;;
h)
howto
exit
;;
?)
howto
exit
;;
esac
done

#get data from stdin
INPUT="$(</dev/stdin)"

querystring="paste_private=0&paste_code=${INPUT}&paste_name=${NAME}&paste_email=${EMAIL}&paste_format=${TYPE}"

#post data to pastebin.com API
curl -d "${querystring}" http://pastebin.com/api_public.php

echo ""

0 comments on commit 5121464

Please sign in to comment.