basename
example.
tar
.gz .
tar
.gz
# => example
FILE=
"example.tar.gz"
echo
"${FILE%%.*}"
# => example
echo
"${FILE%.*}"
# => example.tar
echo
"${FILE#*.}"
# => tar.gz
echo
"${FILE##*.}"
# => gz
来源: <http://www.jb51.net/article/51592.htm>
时间: 2024-10-07 23:04:50