Date: Tue, 31 Oct 2017 09:49:21 -0500 From: Dan Mack <mack@macktronics.com> To: Devin Teske <devin@shxd.cx> 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: <m2lgjrqsni.fsf@macktronics.com> In-Reply-To: <9CD7866D-BF74-4618-8FFE-E9C47D4DA328@shxd.cx> (Devin Teske's message of "Mon, 30 Oct 2017 21:33:35 -0700") 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> <9CD7866D-BF74-4618-8FFE-E9C47D4DA328@shxd.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
Devin Teske <devin@shxd.cx> writes: >> On Oct 30, 2017, at 2:35 PM, Dan Mack <mack@macktronics.com> wrote: >> >> Devin Teske <devin@shxd.cx> writes: >> >>> Better in bash which allows you to filter not only on "begins with" >>> but also "contains" (which is arguably more valuable than "begins >>> with"). >> >> 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 saves me valuable keystrokes and allows me to find history elements faster with less 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 sequentially like that. > > However... there is the fallback of history substitution to pluck elements in tcsh which also works in bash: > > !?text?:p > > This will copy the most recent history element containing "text" onto the top 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 syntax "!?text" will still work but > without the "?:p" modifier will execute the match right away. > > However, this cross-shell history substitution feature does not allow matching 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. ^^ i use '!$' constantly to pull up the last argument to the previous command Definately appreciate your perspective. My lack of doing this the bash way is really just a side effect of being an early tcsh user, bash not being everywhere I needed it, habbit, and prefix thinking with respect to searching command history. Dan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m2lgjrqsni.fsf>