代码: file=”thisfile.txt” echo “filename: ${file%.*}” echo “extension: ${file##*.}” 输出: filename: thisfile extension: txt