|
Open file with correct application
Can someone please help me with my bourne shell script. I am a struggling newbie. I need create a script that will read an argument from a command line, access a config file with application file types, and open the file with the correct application. The file needs to be able to handle file extensions like .c or .h and exceptions. My config looks like:
#This is a sample .dorc
Application/PostScript ps /usr/bin/ggv
and my current shell script:
#!/usr/bin/bash
filename=$(basename ${1})
echo $1
file_ext=${filename##*.}
echo $file_ext
line=$(grep $file_ext sample.dorc | cut -f3 $i)
$line $1
Thanks in advance for any help.
|