This is a bug with basename 5.3.0 found in the latest Cygwin 1.5.15.1. This used to work with basename in the March 2003 version. Sorry I don't know the version number any more because the update removed the old version. $ FCF=N/A $ echo $FCF N/A $ Z=${FCF:(-1)} $ echo $Z A $ FCG=`basename $FCF $Z` $ echo $FCG A <====== should return 'N/' Another simpler way to see the bug: $ basename NA A N $ basename N/A A A <====== should return 'N/' Even with quoting: $ basename 'NA' A N $ basename 'N/A' A A <====== should return 'N/'