help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] History Expansion


From: David Niklas
Subject: Re: [Help-bash] History Expansion
Date: Fri, 19 Feb 2016 00:21:50 -0500

Mon, 15 Feb 2016 18:08:24 "J.B." 
<snip>
> What I'd like to do instead is use history commands to quickly replace
> the long file path/name with a different one.
> 
> What I've more recently tended to do is Ctrl-P, Ctrl-X Ctrl-E (or `fc
> -e vim' if $EDITOR is set to emacs or nano) and edit the command line
> using vim's efficient editing commands. But I'd really just like a way
> to tell bash, "replace that long string that matches '!?really/lon?:%'
> with 'some/other/file'." (plus, vim's filename completion is way too
> slow (^X^F)).
> 
> But the closest I can get is `!:s/"type the entire file name"/"type the
> new file name"', which is a real drag.
> 
> Something else that is a bit more useful is to specify the file name
> first (with a redirect), which shortens the distance the cursor has to
> move: < path/to/file tailf -n 1 [etc ....]
> 
> But that assumes I don't just mindlessly bang away at the keyboard,
> which is a bad assumption. (I'd be in so much trouble if bash didn't
> accept flags/options scattered throughout the command line).
> ls /path/to/a/file -Fd /and/another/file/here -lt
Perhaps someone else knows what bash means by "Event specification" with
respect to the section on "Word designators" in bash's man page. I can't
figure it out for the life of me.

I though of another way that's shorter then ^Fa^Fb^.
export file="/some/long/path/to/file.txt"
tailf $file
export file="/new/long/path/to/file.txt"

Alternatively, if the file names remain the same across runs they can be
permanent variables.

Sincerely, David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]