Fork me on GitHub

Features


        
			


  • Search thru online snippets
  • View them, source them
  • Bake your snippets into one shellscriptfile
  • use local or remote webpipes to let webapplications appear as unix commands
  • free bashlive webpipes: processing-tools for html/csv/json markuplanguages e.g.

BASHLIVE is not a static library nor an extra dependency for your shellcode, it decorates bash and adheres to the livecoding trend.

Webpipes!

Pipe things thru a webpipe/api in the cloud like a RESTful ninja

        
    $ args=(-H "x-auth-token: 04e40" "http://foo.com/api/v2")
    $ curl -X PUT "${args[@]}"/dominate" --data '{"item":"world"}' | jsonpath \$['result'] 
	{
          "msg": "not going to happen",
	  "reason": "Chuck Norris"
        }
          

See the webpipes-page for more info.

Handle dataformats!

Bash has no support for mangling json/csv/xml data. Bashlive webpipes take care of this (in Beta).

        
            
$ echo '1' | xml2json
{"item":[{"@attributes":{"foo":"bar","nodeValue":"1"},"one":{}}]}
$ curl -X PUT "${args[@]}"/dominate" --data '{"item":"world"}' | json2csv
            
          

Readable oneliners!

Your collegues will finally understand the oneliners you post in the workchat:

        
            
		cat foo.csv | getcsv 3 | trim | substr 0 20
            
          

Easily source remote configs

        
			
# for all people who dont care about security (prototyping stage e.g.):
# here's how to source external stuff 
/ https://gist.github.com/username/9827398423/raw/mylibrary.bash!

          

Improve share- and readability

BASHLIVE scripts can use the library functions (see functions API) and can be removed/baked later

        
			
#!/bin/bash
. bashlive    
/ /bash/function/string/trim!
/ /myrepo/function/string/wraplines!

echo " im being processed by online gist-functions " | trim | wraplines

          

Bake into script

Just run this command on the previous script ('myapp') to embed the functions in there:

        
            
$ / myapp
freeze bashlive into script? (y/n) y
$ cat myapp 

  #!/bin/bash 
  # generated by bashlive

  # source: https://gist.github.com/coderofsalvation/8328455
  # remove leading and trailing whitespaces
  # usage: echo " foo bar " | trim 
  
  trim(){
      cat - | sed -e 's/^ *//g' -e 's/ *$//g'
  }

  [MORE]
            
          

Updating


Make sure you run this command once in a while:

        
            
$ bashlive::update 
bashlive> indexing 'https://raw2.github.com/../'
bashlive> done (1664 items were indexed)

This will wipe out the cache, and re-index all (newly added) online resources.
For featurerequest create an issue with an 'enhancement'-label


What about security?


Private completion repos and http-authenticated urls are possible. Also, BASHLIVE will ask you before inserting/sourcing online code (unless '!' is used). Beyond that, common sense, knowledge and experience is a must.
Keep in mind BASHLIVE is focused on prototyping: dont blame a monkey for not being a horse.

JSON (API) Accessible code repos


BASHLIVE repositories can be accessed using JSON. For example the official repo can be accessed here

Add/share your project/code


Just fork a repo on github (for bash use this repo), add your snippets, and do a pull request. Sharing is caring. Bash snippets and functions are scattered around forums e.g., lets change that shall we?

Private completion repos

Enable private repos by adding an index-file to the bashlive script itself.
The easiest way is to manually create an index.txt file like this

As you might have noticed, the indexfile-format is tabdelimited (or 4 space-delimited) like so:

        
            
 <path><tab><description><tab><url>

Store the indexfile on the web, and add the url to bashlive:

            
 REPOS=("https://raw.github.com/coderofsalvation/bashlive.repo/master/index.txt") 
 REPOS+=("https://raw.github.com/yourname/bashlive.yourlanguage/master/index.txt")
          

Run 'bashlive::update' and 'bashlives' to test it.

Lazy hackers are adviced to generate this indexfile.
To generate it, setup your own repo, by forking this repo and run './compile'.
The advantage is that it writes raw-gisturls (last commit) to index, while you can maintain simple gisturls.

Updating or resetting bashlive

Make sure to run this to update the local cache

        
            
$ bashlive::update 
  indexing 'https://raw.github.com/coderofsalvation/bashlive.repo/master/index.txt'
  indexing 'https://raw.github.com/yourname/bashlive.yourlanguage/master/index.txt'
  done (329 bashlives collected)
            
          

Community / I need help!

For bashlive-related questions create an issue here. Visit the #bash chatchannel for bash-related questions (Be polite: first state your situation, your desired situation and attempts in one line). BASHLIVE related questions can be asked using the Issuetracker.