${name:e}: File Extension

Extracts the file extension from a path.

It takes the last segment of the path and returns the string after the last . of this filename segment. If there is no . character or if the filename ends with ., then an empty string is returned.

Examples

Extract file extension of a path
1
2
myPath="/home/user/work/data.csv"
echo $myPath:e
Output:
1
csv
BashSupport Pro is a Zsh IDE with support for $varName:etry it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal