Extracting filename

I am using bash and have a filename with a path and extension and want to extract just the filename

Have used the following code, oflna gives the file name with extension, but now neet to remove the .texi at the end.

oflna=${flnm##*/}

oflnb=${${flnm##*/}%.*}

echo "flnm: $flnm"
echo "oflna: $oflna"
echo "oflnb: $oflnb"
flnm: /home/hagbard/chaos/resip/critical/resources/reports/tdr/Development/tdr--1.0/tx411/Ch04a--Segpi--SgExtrcn--GPhy.texi
oflna: Ch04a--Segpi--SgExtrcn--GPhy.texi
oflnb: 

Hi, it does not work that way. Instead try:

oflnb=${oflna%.*}
1 Like