How to Share Simple Bash Tasks with Others by Using Sparrow

Alexey Melezhik - Oct 31 '17 - - Dev Community

Sparrow is a Linux scripting platform to ease the daily scripting jobs and distribution. In this small post I am going to show you how to share simple Bash tasks with the rest of the world.

Install Sparrow

$ sudo yum install curl
$ cpanm -q --notest Sparrow 
Enter fullscreen mode Exit fullscreen mode

Create Bash Task

First of all we need Bash plugin:

$ sparrow index update
$ sparrow plg install bash
Enter fullscreen mode Exit fullscreen mode

Then let's create a task. I always forgot how to install Rvm/Ruby so I want a mnemonic command for this:

$ sparrow project create utils
$ sparrow task add utils ruby-rvm-stable bash 
Enter fullscreen mode Exit fullscreen mode
$ EDITOR=nano && sparrow task ini utils/ruby-rvm-stable
command: "\curl -sSL https://get.rvm.io | bash -s stable --ruby"

Enter fullscreen mode Exit fullscreen mode

Share Bash Task

First of all you need to get an account at SparrowHub, because you're going to save your task into the account.

Then having set credentials up:

$ cat ~/sparrowhub.json

{
  "user"  : "melezhik",
  "token" : "*****-****-****-*******-*****"
}

Enter fullscreen mode Exit fullscreen mode

Just upload the task with some useful description:

$ sparrow remote task upload utils/ruby-rvm-stable "Install RVM stable with ruby"
Enter fullscreen mode Exit fullscreen mode

By default your tasks are private so it is only you who can see them. Let's take simple step to changes this:

$ sparrow remote task share utils/ruby-rvm-stable
Enter fullscreen mode Exit fullscreen mode

Running Remote Bash Task

Now the rest of the team could enjoy your little nifty task. To do this they only need Sparrow client installed:

$ sparrow remote task run melezhik@utils/ruby-rvm-stable
Enter fullscreen mode Exit fullscreen mode

Community Remote Tasks

To list SparrowHub community remotes task just say this:

$ sparrow remote task public list
Enter fullscreen mode Exit fullscreen mode

Further reading is Sparrow documentation on remotes tasks.

Conclusion

Sparrow enables creation of scripts in easy and fun manner. Or if you want - "Quick and dirty way to develop some useful script and share with others".

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player