Combining parameter expansion forms

You cannot combine the preceding parameter expansion forms into one expansion; "${myvar:-foo#.ext}" does not do what you might hope. You could use a temporary variable instead, to run them one at a time:

#!/bin/bash
temp="${myvar:-foo}"
printf '%s\n' "${temp#.ext}"