![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Correct me to run a sh file in ksh shell! | trantuananh24hg | SUN Solaris | 4 | 06-10-2008 06:01 PM |
| Book review: Open iPhone Application Development | iBot | UNIX and Linux RSS News | 0 | 06-03-2008 01:40 PM |
| Correct format in a log file | sd12 | UNIX for Advanced & Expert Users | 11 | 12-12-2007 02:40 PM |
| Computing: Free Application Software and Open Data Standards (Part 3) - Amerisurv (pr | iBot | UNIX and Linux RSS News | 0 | 06-18-2007 11:10 AM |
| Which application has a TCP socket open | murphyboy | UNIX for Dummies Questions & Answers | 3 | 10-26-2005 02:29 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
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. |
| Forum Sponsor | ||
|
|
|
|||
|
Thanks for you reply
Thanks for your help. I tried your re-write but it gave me a command not found error. I'm sure I made a mistake somewhere. I'm really new at this. The purpose of my script is to basically perform the same functionality as a double click in windows. If I double click on a word file it opens in MS Word. My script should take the filename in the command line and open it with the correct application. I appreciate the help.
|