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

Re: Parameter Expansion



On Tue, Jul 15, 2025, at 5:14 PM, Vin Shelton wrote:
>> Are you leaving the first element unmodified intentionally?
> No. I had to add ${HOME}/ to the beginning of my print command. Is 
> there a way to automatically add it to every element of the array?

Yes, things like "#", "%", and "/" work on arrays elementwise:

	% files=(foo bar baz)
	% printf '<%s>\n' ${files/#/$HOME/}
	</home/me/foo>
	</home/me/bar>
	</home/me/baz>

-- 
vq




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