> NAME="./`basename $0 | sed s@\./t\.@@`" Well, basename $0 will return t.grftest, so the sed won't match, and you'll have NAME equal to ./t.grftest. If that's acceptable then the sed is completely unnecessary. Otherwise, if you want ./grftest, then change it to sed s@^t\.@@