expansion

Bash Replace leading match

Restricts replacement to a match at the beginning.

Formal Syntax & Structure

bash syntaxbash
${p/#pattern/string}

Return Value

shell expansion result

Restricts replacement to a match at the beginning.

Working Example

Example Snippetbash
p=a-aprintf '%s\n' "${p/#a/b}"
Bash Reference