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 "/"`