![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| launch an executable from a C++ program | nadiamihu | High Level Programming | 2 | 11-03-2006 05:59 AM |
| Passing Parameters and getting values back from a c program to Shell script | Rajeshsu | High Level Programming | 5 | 08-22-2005 04:12 AM |
| parameters from my program in c to a .ksh script | DebianJ | High Level Programming | 2 | 05-16-2005 07:04 PM |
| how to launch program though telnet | cbachman | UNIX for Dummies Questions & Answers | 3 | 03-21-2005 04:31 PM |
| Run a program and feed her parameters automaticly | roco | Shell Programming and Scripting | 2 | 10-29-2002 07:16 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
BASH: how to launch a program with parameters
Hi, I'm a pretty big fan of BASH scripting. I've got a bunch I use for random things and lately a couple issues have been plaguing me. Both are somewhat related, in that they deal with filenames with spaces and "escaped" characters and with launching a program with command line arguements (which invariably include these filenames). for instance. I have a bunch of MKV movies with embedded subtitles. I'd like to extract the subtitles into their own SRT file. so I've got this basic script written: Code:
#!/bin/bash
MOVIE=$1
echo "Original Movie: $MOVIE"
SRTFILE=${MOVIE/%mkv/srt}
echo "srt File: $SRTFILE"
TRACK=`mkvinfo "$MOVIE" | grep subtitle -B3 | grep Track\ number\:\ | sed -e 's$
#echo "Track is $TRACK"
if [[ "$TRACK" -gt "0" ]]
then
echo "Track is: $TRACK"
mkvextract tracks $MOVIE ${TRACK}:$SRTFILE
else
echo "No subtitle track!"
fi
which gives me Quote:
mkvextract tracks Ying\ Xiong\ \(Hero\).mkv 3:Ying\ Xiong\ \(Hero\).srt but obviously isn't. The other script I've got that I'd love to get working is one I wrote to combine a series of avi files using avidemux. to do this I wrote a script that takes the input files as the arguements, deduces the output file name and then because of avidemux's arguement procedure I have it create a set of strings that it needs to append to the call to avidemux for each file being added to the original. I have a similar problem with this script as well, but with many more arguements involved. What I've done with this one is have it echo the required command to run which I can then copy and paste and it works fine, but it would be much nicer if I could get it to actually *launch* said command. phew, hopefully someone that knows how to solve this bothered to read through this long post, and to you sir, I thank and congratulate you, especially if you have an answer to my troubles! thanks! |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|