~/bin/remind

August 29, 2011

Here is a very simple helper script I came up with today:

#!/bin/sh
grep $1 ~/.bash_history | uniq

I’m currently using Maven on a client project and I keep forgetting the various invocations of mvn. So this helps remind me.

Example:

[ ~/wb/foo ] $ remind mvn
mvn 
which mvn
mvn -v
mvn -cpu hpi:create
mvn package
mvn --help
mvn -o package
mvn install
mvn -DdownloadSources=true -DdownloadJavadocs=true -DoutputDirectory=target/eclipse-classes eclipse:eclipse
mvn hpi:run

This is handy for those cases where I want an overview of all ways in which I’ve recently used a command.

If I just want to recall a specific command, I use bash’s Ctrl-R and whichever few letters of the command I remember:

ctrl-R ec

This will recall the long second-to-last command in the example above.

 

About these ads
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: