Eu assumo, você fala sobre print ${$(pwd)} ou algo assim, certo?!
A expansão de ${$(pwd)} para o diretório de trabalho atual é o comportamento esperado, embora possa parecer estranho à primeira vista. Não se engane pensando que a substituição do comando $(pwd) é avaliada primeiro e o resultado é usado como nome da variável ... não, é usado como o valor da variável como man zshexpn explica:
${name}The value, if any, of the parameter name is substituted.(...) If a
${...}type parameter expression or a$(...)type command substitution is used in place ofnameabove, it is expanded first and the result is used as if it were the value ofname. (...) The form with$(...)is often useful in combination with the flags described next; see the examples below.(...) The flag f is useful to split a double-quoted substitution line by line. For example,
${(f)"$(<file)"}substitutes the contents of file divided so that each line is an element of the resulting array.
Para o seu segundo exemplo. Acho que esta é a sintaxe de substituição de padrões:
${name/pattern/repl}Replace the longest possible match of pattern in the expansion of parameter name by string repl. (...)
Veja este exemplo primeiro:
$ foo=hello
$ print ${foo/hello/good/bye}
good/bye
Se você omitir foo , informe zsh para fazer uma pesquisa e substituir na variável ${} , que está vazia:
$ print ${}
$
- consequentemente, ${/something/foo/bar} retorna uma string vazia também.