Open a file from within a Bourne shell Script

I am suppose to make a program that cuts the extension off of a file. It uses that .ext to decide which program needs to be used to open the file. This only finds the name of the program from a list of programs I made. My problem is when it has the name of the program it needs to use, how can I make the program open the file with code in the script.

It is okay to assume that files will only have one period.

Code so far:

#!/usr/bin/bash -x

FNAME=$1
export FNAME
FILE_EXTENSION=`echo $FNAME | cut -f2 -d "."`

a=`grep  $FILE_EXTENSION dorc.sh`
echo $a
PROG=`echo $a | cut  -f5 -d "/"`

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.

1 Like

Yeah, sorry I tried to delete the other one, but there isn't a delete option. I thought that the post was more relevant to shell forum after I posted in that other one.

Ok - I move it there then. If you have any issues like this, contact a moderator please. I will remove the warning/reminder for the double post.
Ah I see I missed to close this thread and you got an answer in the other one, nvm. Setting a link to the other one and closing this here.