Re: Parameter Expansion

Lawrence Velázquez <[email protected]>
Newsgroups gmane.comp.shells.zsh.user
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.