zsh-users
 help / color / mirror / code / Atom feed
* vanishing spaces
@ 2024-03-30 15:18 Ray Andrews
  2024-03-30 16:07 ` Bart Schaefer
  2024-03-30 16:07 ` Marc Chantreux
  0 siblings, 2 replies; 4+ messages in thread
From: Ray Andrews @ 2024-03-30 15:18 UTC (permalink / raw)
  To: Zsh Users

     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.






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-30 17:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-30 15:18 vanishing spaces Ray Andrews
2024-03-30 16:07 ` Bart Schaefer
2024-03-30 16:07 ` Marc Chantreux
2024-03-30 17:16   ` Ray Andrews

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).