[ale] tip: Bash History seeding
Richard Bronosky
Richard at Bronosky.com
Fri Aug 14 23:03:41 EDT 2009
I'm sure we all love scripting the mundane tasks we do daily. But, it
feels a little silly putting a one-liner into a file. So, many people
will cram them into their .bashrc/profile or something similar. I do
that, but a lot of times I'm too lazy to fire up vim so I just figure
I can search my history for it next time. Years ago I realized that I
can make the searching much easier by adding a comment to the end.
Example:
sudo htpasswd -b /var/www/trac/.htpasswd $name changeme #newtracuser
I use dozens of these daily and I'm surprised by how many geeks are
shocked when they see me do it. So, I just thought I'd share.
Enjoy
Useful tidbits:
1. Unlike the aliases and functions that pile up in your .bashrc, if
one of these turns out to not be needed it will eventually "expire".
2. Come up with a convention or "namespace" like #t:taskname for tasks
#n:notes... or #apache:tg for configtest && graceful
3. If you remember the seed, you can call it quickly with ctrl+r (See
man readline /Commands for Manipulating the History)
4. If you don't remember the seed you can history|grep "#.:" or
history|grep "#t:" (this is why I've started using a convention. I #
out a lot when I'm trial-and-erroring for loops and such.)
.!# RichardBronosky #!.
More information about the Ale
mailing list