${(%)…}: Expand as prompt

Expands all % escapes in the same way as in prompts. %% is enabling full prompt expansion.

Examples

Print username, TTY, and machine using prompt expansion
1
2
message='User "%n" on TTY "%l" on machine "%M"'
echo ${(%)message}
Output:
1
User "UserName" on TTY "pts/1" on machine "MachineName"
BashSupport Pro 是一款支持 percent** 的 **Zsh 集成开发环境 - 立即试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款