Date: Mon, 24 Oct 2016 20:52:11 +0200 From: Polytropon <freebsd@edvax.de> To: Ernie Luzar <luzar722@gmail.com> Cc: Freebsd Questions <FreeBSD-questions@freebsd.org> Subject: Re: csh history search Message-ID: <20161024205211.34a33b02.freebsd@edvax.de> In-Reply-To: <580E516D.7060502@gmail.com> References: <580E2B4F.4000003@gmail.com> <20161024192356.051bb38d.freebsd@edvax.de> <580E516D.7060502@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161024205211.34a33b02.freebsd>