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

Re: Would this (o) be very difficult to add?



On Sep 28, 11:25am, DervishD wrote:
}
}     Another thing I'm doing with all this is storing the generated
} list on an array, because sometimes I wan't to have the list passed to
} a command and stored in a file, and I do with the array:
} 
}     array=(${(f)...})

If you're storing in an array, you should skip the $(print -lP ...) part
(which requires forking a subshell) and do this instead:

    array=( *(e:'REPLY="%0(l..$RANDOM)$REPLY"':) )
    array=( ${(%)array} )

}     command $array
}     print -l $array > file.list
} 
}     Can this be done directly in the command line for the 'command',
} or I'd better stuck with the array and the redirection?

I'm not entirely sure, but I suspect you mean something like this:

    command ${(f)"$(print -lP ... >&1 > file.list)"}

This only works if you have the MULTIOS option set; if you don't use that,
you need something like

    command ${(f)"$(print -lP ... | tee file.list)"}



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