Extracting part of the basename

Hi,

I was wondering if there is an easy way to strip off the required basename. I have a script called apb0110021.sh and the contents of the script are

typeset -u MScript=`basename $0 | cut -d. -f1`
scriptname=sys.Audit.ksh
parms="PROJECT1 dsAudit $MScript 1 BEGIN"
$SCRIPTS/$scriptname $parms

Basically, I am using typeset -u to capitalize the words and extracting the apb0110021 as $MScript.

Change required: After a code review, the script name has to be changed to sys.mrch_mart_apb0110021.sh. Though the script name changes, I would still have to extract only the apb0110021 and pass it as one of the parameters.

Is there an quick turn around solution to this without involving a lot of code change?

Please advice.
Madhu

typeset -u MScript="${0%.*}"
scriptname="sys.Audit.ksh"
parms="PROJECT1 dsAudit ${MScript##*_} 1 BEGIN"
"$SCRIPTS"/"$scriptname" "$parms"

Or with ksh93:

typeset -u MScript="${0:$((${#var}-13)):10}"
scriptname=sys.Audit.ksh
parms="PROJECT1 dsAudit $MScript 1 BEGIN"
"$SCRIPTS"/"$scriptname" "$parms"

Thank You Radoulov....I used the first part and it did work.

Would you please tell me what

"${0%.*}" 

and

${MScript##*_} 

mean by.

I would really appreciate that.

Yes,
see this