zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: "Pull just the text of a single command" (was Re: .zsh_history)
Date: Sun, 16 Apr 2023 12:24:50 -0700	[thread overview]
Message-ID: <3630cc6b-0f1e-7579-4e19-a6c8c366b69e@eastlink.ca> (raw)
In-Reply-To: <CAH+w=7bZfwGgKeznLdHK+ZWXbHo0w=H+HAsEac+kZ-8iBLKuBA@mail.gmail.com>


On 2023-04-16 08:53, Bart Schaefer wrote:
> chain=( ${(s:; :)${(z)1}} )

in preexec ():

chain=( ${(s:; :)${(z)1}} )
print -lr $chain

try it:

0 /aWorking/Zsh/Boot 1 $ echo *; echo howdy; echo $path; echo $path > 
nowhere; echo "Now is the time" | grep 'time'
echo *
echo howdy
echo $path
echo $path > nowhere
echo "Now is the time" | grep 'time'

... so that's about it.  I'm not going to be throwing anything more 
troublesome at it than globs and variables and redirections and pipes, 
and those are remaining as raw text so that's fit for purpose.  Only 
thing that would break it is chained commands which isn't really a 
problem.  However, even there, I can't help but notice that if there was 
a way of matching each one of the chained commands to its appropriate 
member of the array, then even that would be solvable.  Some sort of 
counter for each one of the chained commands?  'echo $path' is command 
#3 above so its match is $chain[3] and its tail is '$path'.  Easy.





  parent reply	other threads:[~2023-04-16 19:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08 16:16 .zsh_history Perry Smith
2023-04-08 16:53 ` .zsh_history Roman Perepelitsa
2023-04-08 17:23   ` .zsh_history Ray Andrews
2023-04-08 17:27     ` .zsh_history Roman Perepelitsa
2023-04-08 17:35       ` .zsh_history Perry Smith
2023-04-08 17:54       ` .zsh_history Ray Andrews
2023-04-14 14:36         ` .zsh_history Felipe Contreras
2023-04-14 15:27           ` .zsh_history Ray Andrews
2023-04-15  4:49             ` .zsh_history Felipe Contreras
2023-04-15 15:29               ` .zsh_history Ray Andrews
2023-04-15 19:47                 ` "Pull just the text of a single command" (was Re: .zsh_history) Bart Schaefer
2023-04-15 22:47                   ` Ray Andrews
2023-04-15 23:26                     ` Bart Schaefer
2023-04-16 15:53                       ` Bart Schaefer
2023-04-16 16:37                         ` Ray Andrews
2023-04-16 19:24                         ` Ray Andrews [this message]
2023-04-16  7:38                 ` .zsh_history Roman Perepelitsa
2023-04-16 14:53                   ` .zsh_history Ray Andrews
2023-04-16 15:28                     ` .zsh_history Bart Schaefer
2023-04-16 15:29                     ` .zsh_history Roman Perepelitsa
2023-04-14 14:28     ` .zsh_history Felipe Contreras
2023-04-14 15:18       ` .zsh_history Ray Andrews
2023-04-14 14:00   ` .zsh_history Felipe Contreras
2023-04-14 14:51 ` .zsh_history Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3630cc6b-0f1e-7579-4e19-a6c8c366b69e@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).