I suggest (of course you don't have to) putting an eval "$_"
after the echo
command, so the alias is added right away, and a grep -Pq "alias $1" && return
at the start, to make sure that (1) you don't have duplicate alias names, (2) aliases get defined right away instead of waiting for them to be re-sourced.
If you want to get even more creative (this is how I do it), also allow it to take a number from your history, and define it as an alias, or a group of numbers assigned in sequence to one alias, or more, etc.
I've put quite a lot of work into my own .bashrc over the years -- I do share it under a project called gxbase, but since it is "my preferences" it most likely is not what "other people" want. Configuration settings are a very personal thing. Most people expect things to look like /etc/skel/.bashrc
, and stuff like bash completion stops working if you set too many custom options :) Just for fun though, my link is http://gitorious.org/gxbase. The file is in extras/my.bashrc/*
(see PS at bottom if interested).
As for your question, there are many people out there who post their so-called 'ultimate .bashrc settings' but alas they are only ultimate for them, my answer is: you will be happiest if you create this file yourself, and believe me, for the love of all that's holy; make [offline] backups!!! :) A 'hard (printed) copy' is a good way to plan it further if you want to get even more creative!
PS: The contents of .bashrc-git are a fork from the gitsh project, so most of the credit for that one goes to that guy, and the perlconsole & aptsh integration also are not mine (entirely). You'll have to install the modded perlconsole & aptsh files to get that fully integrated into virtual directories.
help
in your terminal; you will not find nothing appropriate to your function. 2) Do you really need a special package to install it for such a small function? It is probably more quickly to write it than to install it...grep $1 /home/User/.bashrc
right before you modify your.bashrc
, to at least notify the user that there is already an existing alias with this name – Aserre Aug 05 '14 at 09:27