From owner-freebsd-questions@freebsd.org Mon Oct 24 17:24:06 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C0E0C1E908 for ; Mon, 24 Oct 2016 17:24:06 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05D185E8 for ; Mon, 24 Oct 2016 17:24:05 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de (port-92-195-117-205.dynamic.qsc.de [92.195.117.205]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPS id 0429427827; Mon, 24 Oct 2016 19:23:56 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id u9OHNusS002285; Mon, 24 Oct 2016 19:23:56 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Mon, 24 Oct 2016 19:23:56 +0200 From: Polytropon To: Ernie Luzar Cc: Freebsd Questions Subject: Re: csh history search Message-Id: <20161024192356.051bb38d.freebsd@edvax.de> In-Reply-To: <580E2B4F.4000003@gmail.com> References: <580E2B4F.4000003@gmail.com> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2016 17:24:06 -0000 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, ...