Skip to content

danielb2/rubsh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rubsh

Rubsh was created to be a native shell for ruby users. A irb which can also be used as a normal shell without the akwardness of some of the features of bash and other shells, and with the power of ruby.

Installation

sudo gem source -a http://gemcutter.org
sudo gem install rubsh

Run rubsh on the commandline. Type help for a quick overview of usage.

Features

  • readline support

  • tab completion

  • aliases

  • commandline history

Usage

aliases

ralias aliases a command.

Example:

ralias 'ls ls -Gh'

Currently an alias will not be parsed to include other aliases. i.e. doing ralias 'ls ls -Gh' followed by ralias 'll ls -l' will not get you ‘ls -lGh’

.rubsh/rc.rb

Define your own functions, aliases etc in the rc file. It’s included to the environment.

Shortcuts

While normal commands as ‘ls’ etc work transparantly, you can also do things like:

'*'.ls

shortcut for Dir.glob(…)

'*'.ls.du

Does du on all the results

It also takes arguments:

'*'.ls.du(:sh)

is equivalent to du -sh *

Prompt

use ENV to set your prompt. see ‘help prompt’ for options from within the shell.

%h  - hostname
%u  - the username of the current user
%w  - the current working directory, with $HOME abbreviated with a tilde
%W  - the basename of the current working directory, with $HOME abbreviated
with a tilde
%Cb - blue color
%Cc - cyan color
%Cg - green color
%CC - color reset
%t  - the current time in 24-hour HH:MM:SS format
%%  - literal %
%$  - if the effective UID is 0, a #, otherwise a $

Example: ENV['PR1'] = "[%u@%h]--(%t)\n\r[%w]%$ "

Commandline functions

Commandline functions must currently be defined as one-liners. They also take an argument, which is what was typed to invoke the command.

def test(*a); p a;end
$ test foo #=> ["test foo"]

Releases

No releases published

Packages

No packages published

Languages