${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 是一款支持 e** 的 **Zsh 集成开发环境 - 立即试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款