Friday, June 4, 2010

Create new function for your Shell

Well, if you hate writing same thing every time in bash shell, you can create your own fucntion.

First, open .bashrc with your editor. It's in your home directory and it's hidden files.

When you open .bashrc, goto end of file and write this;

function install {
sudo apt-get install
}

Save .bashrc and now open new shell, and example write this;

install conky
it's will do this;
sudo apt-get install conky

In this example i try install conky.

As you can see, we just write "install" for "sudo apt-get install".

And one more example; i was writing every time "sudo mount /dev/sda1 /mnt" for mount my other hdd partitions. And i create this function;

function mnt {
sudo mount /dev/sda1 /mnt
}

And when i want mount partition, i just type mnt

Sorry for bad english. I promise i will repair my language :)

No comments:

Post a Comment