From: Ray Andrews <rayandrews@eastlink.ca>
To: Zsh Users <zsh-users@zsh.org>
Subject: vanishing spaces
Date: Sat, 30 Mar 2024 08:18:30 -0700 [thread overview]
Message-ID: <3643c571-5830-420c-9d1f-88a6bf22cc0e@eastlink.ca> (raw)
aptitude columnizes its output nicely: (cut down here to avoid
wrapping):
% aptitude search '~i?name(nvidia)'
i A glx-alternative-nvidia - allows the selection of
NVIDIA i A libegl-nvidia-tesla-470-0 - NVIDIA binary EGL
library
i A libgl1-nvidia-tesla-470-glvnd-glx - NVIDIA binary OpenGL/GLX
i A libgles-nvidia-tesla-470-1 - NVIDIA binary OpenGL|ES 1.x
... I have reason to capture the output of several versions of
aptitude searches into a variable. I hope 'eval' is the right way:
output=$( eval $* ) # Save output to an array variable.
... where: '$*' ... is the command string that's been put together
elsewhere.
print -l $output
i A glx-alternative-nvidia - allows the selection of NVIDIA as GLX provider
i A libegl-nvidia-tesla-470-0 - NVIDIA binary EGL library (Tesla 470
version)
i A libgl1-nvidia-tesla-470-glvnd-glx - NVIDIA binary OpenGL/GLX library
... the nice columns disappear. However:
eval $*
... shows it with columns intact so eval itself is not the issue
it's somewhere in the capture of the variable. How can I fix that? I'm
used to doing battle with splitting issues but this seems different.
'typeset -p' shows me nothing useful. Is this one of those things were
zsh is helpfully removing an empty element? Somehow the padding spaces
are their own separate element and since empty, removed? That's my only
guess. I've tried a dozen variations on quoting with no luck. I know
how to preserve empty lines, but that doesn't work here.
next reply other threads:[~2024-03-30 15:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-30 15:18 Ray Andrews [this message]
2024-03-30 16:07 ` Bart Schaefer
2024-03-30 16:07 ` Marc Chantreux
2024-03-30 17:16 ` Ray Andrews
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=3643c571-5830-420c-9d1f-88a6bf22cc0e@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).