On Mon, May 21, 2012 at 3:23 PM, Greg Wooledge
<address@hidden> wrote:
It appears you are trying to trim all the trailing whitespace from a
string variable. You can do that with extended globs:
shopt -s extglob
echo "'${string%%+([[:space:]])}'"
Or if you don't want to use extended globs, you can do it two steps:
remove=${string##*[![:space:]]}
echo "'${string%$remove}'"
Normal globs (like the ones you were attempting to use) do not have a
full closure operator, so you can't say "0 or more spaces".