Date: Mon, 30 Oct 2017 21:33:35 -0700 From: Devin Teske <devin@shxd.cx> To: Dan Mack <mack@macktronics.com> Cc: Alexey Dokuchaev <danfe@FreeBSD.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, Eitan Adler <eadler@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Cy Schubert <Cy.Schubert@komquats.com>, Ed Maste <emaste@freebsd.org>, Warner Losh <imp@bsdimp.com> Subject: Re: svn commit: r325092 - head/usr.bin/fortune/datfiles Message-ID: <9CD7866D-BF74-4618-8FFE-E9C47D4DA328@shxd.cx> In-Reply-To: <m2k1zc5ng7.fsf@macktronics.com> References: <201710291851.v9TIpM0I073542@slippy.cwsent.com> <B855A05D-E1BB-485F-AB8D-9F9656F531CC@shxd.cx> <m28tfsofph.fsf@macktronics.com> <20171030151627.GA74374@FreeBSD.org> <3CB26689-0D12-4E69-9BBA-58CCC3B71F3F@shxd.cx> <m2k1zc5ng7.fsf@macktronics.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Oct 30, 2017, at 2:35 PM, Dan Mack <mack@macktronics.com> wrote: >=20 > Devin Teske <devin@shxd.cx> writes: >=20 >> Better in bash which allows you to filter not only on "begins with" >> but also "contains" (which is arguably more valuable than "begins >> with"). >=20 > Definately different. Better? Typical session of editing exim acls on the mail server: 1. Log in via ssh to bash 2. Esc-P vi ENTER (pulls up "sudo vi /usr/local/etc/exim/acls/relay_domains") 3. ENTER 4. Make changes in vi, save, exit 5. Esc-P restart ENTER (pulls up "sudo service exim restart") 6. ENTER Ok, so if I was using tcsh, I cannot call this "better": 1. Log in via ssh to tcsh 2. sudo vi Esc-P (pulls up "sudo vi /usr/local/etc/exim/acls/relay_domains") 3. ENTER 4. Make changes in vi, save, exit 5. sudo service exim r Esc-P (pulls up "sudo service exim restart") 6. ENTER As you can see, being able to match on contents rather than begins-with save= s me valuable keystrokes and allows me to find history elements faster with l= ess effort. Take the example of using "service". Imagine: 1. Esc-P restart 2. Esc-P stop 3. Esc-P reloas Etc. Using the tcsh implementation you simply cannot navigate the history sequent= ially like that. However... there is the fallback of history substitution to pluck elements i= n tcsh which also works in bash: !?text?:p This will copy the most recent history element containing "text" onto the to= p of the history. In bash you can turn on histverify (using shopt) which will allow you to use= simply "!?text" (without quotes) to pull up the previous command containing= "text". In tcsh and zsh -- which lack the histverify shell option -- the sy= ntax "!?text" will still work but without the "?:p" modifier will execute th= e match right away. However, this cross-shell history substitution feature does not allow matchi= ng on "begins-with", only "contains," and as-such is not as flexible as bash= 's Esc-[PN] feature. Though, I admittedly use history expansion a lot too. --=20 Devin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9CD7866D-BF74-4618-8FFE-E9C47D4DA328>