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

Re: Parameter Expansion



Ok, thank you Peter and Eric!

Eric wrote:
The ${param:s-r-l-} in your example is a history modifier, used in history expansion that you see within history expansion section
of the zshexpn manual. as detailed, those modifiers can also be used with parameter expansion. in the case of s/r/l/, parameter
expansion already has a form that can perform substitutions, along with subjecting the search string to additional parameter expansions.

Interesting! I view the segments of the manual as more standalone, more of a reference manual (especially in this age of Google) - otherwise how much context do you need? Not to go all Ed McMahon on you, but I would assume that everything you need to know about [I know he was the fool when he said this] parameter expansion is in the section entitled PARAMETER EXPANSION.

Another issue arises with joining:

  home_files=(
              .local/share/baloo/index
              sshfs
             )
  print ${(j:\n${HOME}/:)home_files}

This yields:

.local/share/baloo/index
${HOME}/sshfs

but I was expecting the ${HOME} to be interpreted. How do I do that?

TIA,
 Vin

On Tue, Jul 15, 2025 at 12:11 PM Eric Cook <llua@xxxxxxx> wrote:
On 7/15/25 11:18 AM, Eric Cook wrote:
> expansion already has a form that canperform substitutions, along with subjecting the search string to additional parameter expanions.
>

haha guess i just gave up when i saw peter reply and still hit send.




--
Whoa, I'm just surprised at how accurate that description of me really is:
some old cowboy guy that used to shoot movies at Spahn Ranch


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