[ale] tip: Bash History seeding

Jim Kinney jim.kinney at gmail.com
Fri Aug 14 23:18:44 EDT 2009


COOL!!!!! grepping history for a grep command 2 weeks ago is just
about futile for me. Adding a simple end-of-line comment is a
brilliantly simple method for retrieval. Many thanks!!!

On Fri, Aug 14, 2009 at 11:03 PM, Richard Bronosky<Richard at bronosky.com> wrote:
> 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 #!.
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
>



-- 
-- 
James P. Kinney III
Actively in pursuit of Life, Liberty and Happiness


More information about the Ale mailing list