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

more splitting travails



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.






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