Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: subsitutions and beginning of lines.



On 10/12/2015 10:03 PM, Bart Schaefer wrote:
On Oct 12,  7:50pm, Ray Andrews wrote:
}
} There's a huge section "HISTORY"
} in the man page

There is?  Where?  There's "HISTORY EXPANSION" but it's all about using
"!"-references on the command line.  There's a subsection on "History"
in the section about options.  Where are you looking?
Yup, that's it.

} but it doesn't mention that and I'll probably
} have to eat my hat when you show me that it does.

This is in "man zshbuiltins" under the "fc" command (to which the
"history" builtin's doc directs you).
Ooops, so it does. Still a brief summary of history specific switches would
be friendly.  'fc' in it's totality is a bit intimidating.

BTW Bart, the way I was trying to do it was educational so I don't regret it,
and I think my question is still a useful exercise: how would we do that
if there was no easy way?  Combining the words results in a 'command not
found' error, since it seems to want to believe that 'history -10 | ....' is one
command so I hafta leave the words unmagically joined yet the normal thing
seems to be to strip spaces down to a single one when making an array,
and that's a problem with the methods I was trying. I don't doubt it's easy if you
get the incantation exactly right.  It doesn't help that all this splitting
is invisible.  As you pointed out:
eval history -n $nnumber $sstring

... is a easy as pie so long as there's no need to massage the output,
but even if you do, I'm betting it's still only a couple of lines. Of course
there's sed, but I'm banking on an internal solution.






Messages sorted by: Reverse Date, Date, Thread, Author