Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Okay, so I want add a command to my Desktop (Or any convenient location), and whenever I run it I want it to clone the HTML5 boilerplate.

$ git clone git://github.com/paulirish/html5-boilerplate.git

And I'm tired of typing it out all the time. So how could I store my commands in a file?.

share|improve this question
add comment

2 Answers

up vote 13 down vote accepted

Open your ~/.bashrc and put this at the end:

alias boil='git clone git://github.com/paulirish/html5-boilerplate.git'

or alternatively, this

boil() {
  git clone git://github.com/paulirish/html5-boilerplate.git
}

From now on, in every new terminal you can use the command boil as an alternative to your long command.

The second version is to prefer, because is more flexible being able to accept and manage parameter, for example if you define

boil() {
  [[ -z "$1" ]] && set "github.com"
  git clone git://"$1"/paulirish/html5-boilerplate.git
}

you can easily change server, if there are mirror.

# without a parameter, the function will use a default
boil
# override the default providing explicitly a server parameter
boid othergit.com

It is only an example, your fantasy surely will generate something more useful.

Obviously you can add as many functions as you need.

share|improve this answer
add comment

Why not create a document with that command, and every time you wish to use it you can simply copy and paste it into the terminal.

share|improve this answer
1  
-1 Because this doesn't answer the question in the way that they are looking for. –  jrg Aug 3 '11 at 18:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.