expansion

Bash Remove shortest prefix

Removes the shortest matching leading segment, not a regex and not a file operation.

Formal Syntax & Structure

bash syntaxbash
${p#pattern}

Return Value

shell expansion result

Removes the shortest matching leading segment, not a regex and not a file operation.

Working Example

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