SRC="/path/to/foo.cpp"
BASEPATH=${SRC##\*/}   
echo $BASEPATH  # => "foo.cpp"
DIRPATH=${SRC%$BASEPATH}
echo $DIRPATH   # => "/path/to/"
Comments