Syntax with pound and percent sign after shell parameter name

Viewed 2187

Please explain the following syntax:

  i##*.

  i%.*   

I understand what it's doing, but I want to know the general pattern (why/how is it doing so).

Code where it appears:

#!/bin/bash

recursive_name_change()
{
    cd "$1"
    for i in *
    do
        #echo "${i##*.}"
        if [ -d "$i" ]
        then
            recursive_name_change "$i"
        elif [ "${i##*.}" = "cpp" ]
        then
             new_name=${i%.*}".c"
        mv "$i" "$new_name"
        fi
        done
        cd ../
    }

recursive_name_change .

Someone please also suggest, where can I find these peculiar syntax forms from?

2 Answers
Related