csh history search

Polytropon freebsd at edvax.de
Mon Oct 24 18:52:22 UTC 2016

On Mon, 24 Oct 2016 14:22:37 -0400, Ernie Luzar wrote:
> ping_ returns this message   ping_: Command not found
> % ping_ returns this message  %: Too many arguments

You need to use your imagination: the % just indicates
the C shell's prompt, and the underscore was meant to
represent the cursor on that line. :-)

	% _

therefore simply symbolized a user's csh with no text
entered so far. :-)

> What "subject" in the questions archive list should I search on to find 
> the thread talking about searching the command history list?

I think it was related to "history search". I will search my
local archives... just a "little moment"... okay, I think I
found something: thread "minor vi/vim qstn" from 09/2013

This is the result which you can turn into an alias or a
shell script:

	history 10 | awk 'BEGIN {histcmds=10} {printf("\t%2d\t%s\n", -(histcmds-i), $0); i++}' | grep -v "histcmds"

The initial purpose (which I forgot) was to output the
"statement numbers" (for the "!<number>" command), finally
as a precmd command (printed before the next prompt).
With an additional grep added, this could be useful so
you don't get "overwhelmed" by too many search results.
By inserting a "non-standard identifier" into the sed
part you can probably deal even better with possible
false positives.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list