zsh-users
 help / color / mirror / code / Atom feed
* more splitting travails
@ 2024-01-12 19:05 Ray Andrews
  2024-01-12 19:19 ` Bart Schaefer
  0 siblings, 1 reply; 83+ messages in thread
From: Ray Andrews @ 2024-01-12 19:05 UTC (permalink / raw)
  To: Zsh Users

There's nothing harder than really getting on top of splitting issues :(

I have a file with blank lines in it, I read it into a variable then 
pass that variable to a function " % n_list $var ".  Inside the function 
I assign to a local variable 'List'.  The file/variable has five lines 
of data and four blank lines.


     #    local List=( "$@" ) # ONE element but $List prints correctly 
with spaces (nine lines).
     #    local List=( "${=@}" ) # FIVE elements but blank lines are 
gone (prints five lines).

How can I end up with nine elements and it prints correctly too? If it 
were a 'normal' variable I know this works:

     List=$some_variable[@]

... but:

     List=$@[@]

... doesn't work and looks sick and twisted anyway.

Other various attempts give me the number of elements being the 
character count.  Weirdly there's places where I iterate over all the 
lines in 'List' and it *counts* nine, but only displays five.

I could pound away at this but I'm going to just ask the people who 
understand these things.




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

end of thread, other threads:[~2024-02-11  7:10 UTC | newest]

Thread overview: 83+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-12 19:05 more splitting travails Ray Andrews
2024-01-12 19:19 ` Bart Schaefer
2024-01-12 19:56   ` Ray Andrews
2024-01-12 20:07     ` Mark J. Reed
     [not found]   ` <CAA=-s3zc5a+PA7draaA=FmXtwU9K8RrHbb70HbQN8MhmuXTYrQ@mail.gmail.com>
2024-01-12 20:03     ` Fwd: " Bart Schaefer
2024-01-12 20:32       ` Ray Andrews
2024-01-12 20:50         ` Roman Perepelitsa
2024-01-13  2:12           ` Ray Andrews
2024-01-12 20:51         ` Bart Schaefer
2024-01-12 21:57           ` Mark J. Reed
2024-01-12 22:09             ` Bart Schaefer
2024-01-13  3:06               ` Ray Andrews
2024-01-13  3:36                 ` Ray Andrews
2024-01-13  4:07                   ` Bart Schaefer
2024-01-13  5:39               ` Roman Perepelitsa
2024-01-13 20:02                 ` Slurping a file (was: more spllitting travails) Bart Schaefer
2024-01-13 20:07                   ` Slurping a file Ray Andrews
2024-01-14  5:03                     ` zcurses mouse delay (not Re: Slurping a file) Bart Schaefer
2024-01-14  5:35                       ` Ray Andrews
2024-01-14 10:34                   ` Slurping a file (was: more spllitting travails) Roman Perepelitsa
2024-01-14 10:57                     ` Roman Perepelitsa
2024-01-14 15:36                     ` Slurping a file Ray Andrews
2024-01-14 15:41                       ` Roman Perepelitsa
2024-01-14 20:13                       ` Lawrence Velázquez
2024-01-15  0:03                         ` Ray Andrews
2024-01-15  0:55                           ` Empty element elision and associative arrays (was Re: Slurping a file) Bart Schaefer
2024-01-15  4:09                             ` Ray Andrews
2024-01-15  7:01                               ` Lawrence Velázquez
2024-01-15 14:47                                 ` Ray Andrews
2024-01-18 16:20                                 ` Mark J. Reed
2024-01-18 17:22                                   ` Ray Andrews
2024-01-18 17:36                                     ` Mark J. Reed
2024-01-18 17:55                                       ` Ray Andrews
2024-01-18 22:34                               ` Bart Schaefer
2024-01-18 23:08                                 ` Ray Andrews
2024-01-19  2:46                                   ` Bart Schaefer
2024-01-19  2:58                                     ` Ray Andrews
2024-01-19 10:27                                       ` Stephane Chazelas
2024-01-19 13:45                                         ` Mikael Magnusson
2024-01-19 14:37                                           ` Mark J. Reed
2024-01-19 14:57                                             ` Ray Andrews
2024-01-19 15:46                                               ` Mark J. Reed
2024-01-19 16:01                                                 ` Mikael Magnusson
2024-01-19 17:15                                                   ` Ray Andrews
2024-01-19 17:42                                                     ` Bart Schaefer
2024-01-19 18:45                                                       ` Ray Andrews
2024-01-14 22:09                     ` Slurping a file (was: more spllitting travails) Bart Schaefer
2024-01-15  8:53                       ` Roman Perepelitsa
2024-01-16 19:57                         ` Bart Schaefer
2024-01-16 20:07                           ` Slurping a file Ray Andrews
2024-01-16 20:14                             ` Roman Perepelitsa
2024-01-16 20:38                               ` Ray Andrews
2024-01-16 20:43                                 ` Roman Perepelitsa
2024-01-16 22:27                                   ` Ray Andrews
2024-01-15  2:00                     ` Slurping a file (was: more spllitting travails) Bart Schaefer
2024-01-15  4:24                       ` Slurping a file Ray Andrews
2024-01-15  6:56                         ` Lawrence Velázquez
2024-01-15 14:37                           ` Ray Andrews
2024-01-15 15:10                             ` Marc Chantreux
2024-01-15 15:29                               ` Mark J. Reed
2024-01-15 16:16                                 ` Marc Chantreux
2024-01-15 16:33                                   ` MUAs (was: Re: Slurping a file) zeurkous
2024-01-16  7:23                               ` Slurping a file Lawrence Velázquez
2024-01-16 14:37                                 ` Ray Andrews
2024-01-17  3:50                                   ` Lawrence Velázquez
2024-01-17  5:10                                     ` Ray Andrews
2024-01-15  7:26                       ` Slurping a file (was: more spllitting travails) Lawrence Velázquez
2024-01-15 14:48                         ` Slurping a file Ray Andrews
2024-01-15 13:13                       ` Slurping a file (was: more spllitting travails) Marc Chantreux
2024-02-10 20:48                     ` Stephane Chazelas
2024-02-11  0:59                       ` Mikael Magnusson
2024-02-11  4:49                         ` Bart Schaefer
2024-02-11  5:04                           ` Mikael Magnusson
2024-02-11  4:46                       ` Bart Schaefer
2024-02-11  5:06                         ` Mikael Magnusson
2024-02-11  7:09                         ` Stephane Chazelas
2024-01-13  2:19           ` Fwd: more splitting travails Ray Andrews
2024-01-13  3:59             ` Bart Schaefer
2024-01-13  4:54               ` Ray Andrews
2024-01-13  5:51                 ` Roman Perepelitsa
2024-01-13 16:40                   ` Ray Andrews
2024-01-13 18:22                     ` Bart Schaefer
2024-01-13 19:08                       ` 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).