Date: Mon, 24 Oct 2016 19:23:56 +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: <20161024192356.051bb38d.freebsd@edvax.de> In-Reply-To: <580E2B4F.4000003@gmail.com> References: <580E2B4F.4000003@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 24 Oct 2016 11:39:59 -0400, Ernie Luzar wrote: > Hello List; > Reading this section "History substitution" in csh(1) seems to indicate > I can pull up a previous command from the history list. > > Lets say that a while back I issued this command > ping -c 4 hometown.jones.domain.com > > Now I would like to retrieve that domain name from the history list. > > On the command line I enter !?jon > The complete ping command is retrieved and automatically executed. > > I don't want the found command automatically executed, I just want the > found command inserted to the command line being visible so I can > manually modify it before choosing to execute it. > > I could not find any info in csh(1) about auto exec or how to stop it. > Hoping someone who uses this csh function could help me out. Start by typing the first few characters of the command, e. g. % ping_ then use the up arrow to browse through all commands starting with "ping"; if "ping -c 4 hometown.jones.domain.com" was the last ping command executed, it will show up immediately, and you can start editing the command (Ctrl+right to word-jump, or End Ctrl+W to erase the last word, just as you prefer). The more "words" (or characters) you have at the beginning of the command line, the more "precise" the search results will be ("ping" is more "precise" than "p"). For more sophisticated searching, you could write a simple wrapper around "history | grep" (including a grep -v to remove the search itself from the search result); this topic has been discussed on the list, and you can surely find working code in the archive. -- 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?20161024192356.051bb38d.freebsd>