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

Re: .zsh_history



On Sun, Apr 16, 2023 at 4:54 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
>
> On 2023-04-16 00:38, Roman Perepelitsa wrote:
> > On Sat, Apr 15, 2023 at 5:31 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> >> $ my_function $path $(eval 'ls *') one two three ! < > ``.."" &>^!
> >>
> >> my tail, exactly as typed, is: $path $(eval 'ls *') one two three ! < >
> >> ``.."" &>^!
> > What would this do?
> >
> >      % list=(my_function arg)
> >      % $list
> >
> > What I typed is `$list`, but what is "tail"?
> >
> > Roman.
>
> Naively the tail is just 'arg'.

If in the example above the tail is 'arg', then it should also be
'arg' in the following example:

    % list=(arg)
    % my_function $list

This contradicts what you described earlier. If this is not enough,
consider yet another example:

    % ls
    my_function xyz
    % *

What is tail here?

>  And one intuitively sees that zle will be a good candidate for a solution
> because once ENTER is pressed, what it has in it's buffer must needs be
> a sequence of raw keystrokes.

Indeed, if you need the raw command as it was typed, you can get it from zle.

> But, broken by semicolons so that chained commands know
> where their own tail ends.

Let's see if this makes sense.

    % alias -g sep='hi ; echo'
    % echo sep bye

What do you want to capture when the last line gets executed?

Roman.




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