echo ${string##*.} # this will show everything after last "."
How can i revert (negate) this - show everything before last "."
echo ${string##*.} # this will show everything after last "."
How can i revert (negate) this - show everything before last "."
${string%.*}
will remove the shortest trailing portion matching.*
See for example Parameter Expansion in the excellent BashGuide