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

vanishing spaces



    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.








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