Fork me on GitHub

Livecoding for bashhackers (BETA)



Use BASHLIVE for online bash-completion, webpipes, livecoding, and bash packages.

The project is hosted on Github under a AGPL license. You can report bugs and discuss features on the GitHub issues page, or send tweets to BASHLIVE on Twitter.


View demo!

Getting Started


copy/paste this into your terminal:


 wget http://bashlive.com/bashlive 
 source bashlive
          

(For the paranoid, first run 'sudo su nobody -s /bin/bash'

Done! now type a slash and a space ('/ ') and hit tab for online completion:

        
            
$ / <tab>
/bash/function/general/is_array              
/bash/function/general/is_dir                
/bash/function/general/is_empty              
/bash/function/general/is_file               
/bash/function/general/is_float              
/bash/function/general/is_integer            
/bash/function/general/is_writable           
..[82737 more bashlives]..
            
          

Or simply search on a topic

        
            
$ / function string trim
155 /bash/function/string/trim                     trims leading and trailing whitespace from string 
            
          

Now you can easily source online functions (by entering a path, number or url). Hack and tab away!

        
            
$ / /bash/function/string/trim 

# remove leading and trailing whitespaces
# usage: echo " foo bar " | trim 
 
trim(){
  cat - | sed -e 's/^ *//g' -e 's/ *$//g'
}

source (y/n) ? y

$ echo " bashlive ftw! " | trim
bashlive ftw!
            
          

or just force things with appending a '!'

        
            
$ / /bash/function/string/trim!
bashlive> sourcing livebash '/bash/function/string/trim'

$ / /bash/function/network/args2http! --foo 12 --bar 200
bashlive> sourcing livebash '/bash/function/network/args2http'
?foo=12&bar=200
            
          

Webpipes!

Pipe things to a webpipe/api in the cloud, they will appear as regular unix commands:

        
    curl "http://foo.com/notify/$(cat foo.json | jsonpath \$['name'] | urlencode )" | savetodatabase --table log
          

See the webpipes-page for more info.

Soopapowa in any terminal!

Make yourself comfortable by copy/pasting this into your .bashrc-file (in your homedir):

. ~/path/to/bashlive
TIP #1: vimusers: put 'set shell=bash\ --login' in your .vimrc to enable commands like '!/ trim' or '.!/ 134'
TIP #2: use 'VERBOSELEVEL=0 . ~/path/t/bashlive' if you want no feedback

Why is bash(live) usefull?

We do not need metrics/statistics here to point out that productivity-hacks are a good practice. The future of *NIX shell(scripting) looks bright: many (cloud)applications still rely on bash-scripts till some degree.
So, long story short: even in the myriad of new programminglanguages today, BASH is still kicking butts.

We use it to :

  • pipe stuff
  • automate stuff
  • deploy things
  • configure things
  • test things
  • generate things
  • type things on the fly

All because we need to pipe things.
Since bash v4 it became pretty fast and usable for many things (custom C/C++ builtins, bidirectional sockets, coprocesses, associatives arrays and more)

Requirements


bash v4 (shipped on almost any linux system). MacOSX users are adviced to install GNU's coreutils and findutils.

Workshops

Contact here for bashlive- and bash- related (private/public/company) workshops.

Copyright

Copyright © 2014 Coder of Salvation