I'm confused about arrays. It seems to not populate the array from
spaces if output is from an external command. It only wants newlines.

For example:
sorin ~ > for i in (pidof sh); echo $i;end
31758 30333 30302 27367 21512 11755

sorin ~ > function to_array
              if test (count $argv) -ne 0
                  echo $argv | sed -e 's/ /\n/g'
              else
                  while read data
                      echo $data | sed -e 's/ /\n/g'
                  end
              end
          end

sorin ~ > for i in (to_array (pidof sh)); echo $i;end
31758
30333
30302
27367
21512
11755

sorin ~ > for i in (pidof sh | to_array); echo $i;end
31758
30333
30302
27367
21512
11755

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to