You can actually apply these kinds of operations to arrays, ie: # read into array, linewise files=( ${(f)"$(command)"} ) # use :t and :r on array - those apply per element print -l ${files:t:r} - V