Zsh Mailing List Archive
Messages sorted by:
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)
What I typed is `$list`, but what is "tail"?
I don't understand. You're assigning a variable no? In that case 'arg'
.... hmmmm .... good question. In practice the problem wouldn't arise,
I'm concerned with newly typed keystrokes. In theory tho that's quite
mind stretching. Is there a logical necessity or are options
available? My first stab at it would be that any syntax enclosing
'my_function' must needs be executed as normal since there's no way of
'pre-knowing' that my_function wants special access to its tail as raw
keystrokes. Or, not? Naively the tail is just 'arg'. Dunno, whatever
history does is what I want. History stores commands as typed and
that's what I want. There's just that: "% echo one; echo two; echo
three" problem -- I'd like the middle 'echo' to know that it's tail is
'two' and nothing more or nothing less but of course recall from history
gives all three commands in one serving.
% my_function one; my_function $PATH; my_function three > filename
my tail, exactly as typed, is: one
my tail, exactly as typed, is: $PATH
my tail, exactly as typed, is: three > filename
... I guess the semicolon is the character that must logically end the
tail and can't be part of the tail for obvious reasons. Or in practice
the ENTER key cuz I'm never actually going to chain these commands which
is why in practice just writing to history and recalling from history
works fine (along with 'noglob') ... but it's laborious. 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. Give me those keystrokes! Raw. On the
half-shell. But, broken by semicolons so that chained commands know
where their own tail ends. Thing is that the shell obviously does all
this internally -- chained commands are obviously broken down into their
individual units at the semicolon. The information is obviously there I
just want to see it prior to expansion.
I'm not communicating any of this well. If I wasn't me I'd not be
understanding these posts myself, they are not clear.
Messages sorted by: