file = "thisfile.txt" echo "filename: ${file%.*}" echo "extension: ${file##*.}" 转载于:https://www.cnblogs.com/Xavierr/p/3573594.html