Arrays

Create an array

% local -a buffer
% buffer=(a b c)

Create an array with each words of a string

% string="Welcome to the real world, Neo"
% buffer=(${=string})

Create an array of lines from a file

% buffer=("${(f)$(< /etc/hosts)}")
% echo $buffer[1]
127.0.0.1       eva-O1.linagora.com     eva-01
 
scripting/array.txt · Last modified: 2010/01/05 09:20 (external edit)