file=”thisfile.txt” echo “filename: ${file%.*}” echo “extension: ${file##*.}” 转载于:https://blog.51cto.com/kidly/1548630