LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-14-2007, 05:05 PM   #1
snowman81
Member
 
Registered: Aug 2006
Location: Michigan
Distribution: Ubuntu
Posts: 282

Rep: Reputation: 30
Start one command after another has finished


This should be really simple. I'm trying to burn some episodes to dvd using this command:
Code:
 tovid -in b1.avi -out bloodspell_1
The problem is I have to wait for one to finish and start the next. The next would be in increasing order. So like this:
Code:
tovid -in b2.avi -out bloodspell_2
I was wondering if I put each line in a BASH script right in a row, would it wait for one to finish before starting the next?
 
Old 12-14-2007, 05:29 PM   #2
Hiko
Member
 
Registered: Oct 2007
Location: Penn Valley, CA.
Distribution: Arch, Ubuntu, Fedora, Mint
Posts: 52

Rep: Reputation: 16
Aloha,
Yes it should. bash commands go in sequence one after the other normally. This might be able to be modified but I am not sure how. You could also put a pause after each one finishes so you could do anything else you need to and then "Hit any key to continue." Not sure how to do that either but it's a start.
Mahalo,
Edward
 
Old 12-14-2007, 06:02 PM   #3
snowman81
Member
 
Registered: Aug 2006
Location: Michigan
Distribution: Ubuntu
Posts: 282

Original Poster
Rep: Reputation: 30
Ok, well I created a BASH script but I was trying to be clever and have a variable change the number of the episode like this
Code:
#! /bin/bash

COUNT=8
# bash until loop
until [ $COUNT -gt 12 ]; do
        echo Value of count is: $COUNT
	echo tovid -in b$count.avi -out bloodspell_$count
        let COUNT=COUNT+1
done
This obviously doesn't work so do you have any idea as to how to format the COUNT variable so it fits into the script?
 
Old 12-14-2007, 06:11 PM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Bash is case sensitive (like most unix tools), you need to use
Code:
 echo tovid -in b$COUNT.avi -out bloodspell_$COUNT
 
Old 12-14-2007, 06:13 PM   #5
snowman81
Member
 
Registered: Aug 2006
Location: Michigan
Distribution: Ubuntu
Posts: 282

Original Poster
Rep: Reputation: 30
Awww Man, I knew it was something easy. Thanks.

Oh, one more thing. If it asked a yes or no question before it started the next one, could I just put "yes" on th enext line?

Last edited by snowman81; 12-14-2007 at 07:57 PM.
 
Old 12-17-2007, 04:24 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
I'm not sure who "it" is. If you mean the tovid program, and putting a "yes" on the next line in the script, that won't work. I'm not familiar with this program, but it might have an option to just go ahead without asking any questions, see its man page. You could also pipe the word "yes" into its standard input:
Code:
echo yes | tovid -in b$COUNT.avi -out bloodspell_$COUNT
 
Old 12-18-2007, 04:03 AM   #7
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
No, the yes program is meant to automazically answer yes to questions which stop execution. What you need is read:
Code:
.... code

echo "Would you like to continue? y/n"

read ANSWER

if [ "$ANSWER" = "y" ] ; then
  true
else
  exit
fi
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What do you do after all is finished mdkusr General 12 01-29-2006 11:44 PM
Why after start of a command the invitation for input next command has not appeared. ukrainet Linux - General 3 06-24-2005 08:16 AM
Finished Slackware installed and booted to a command prompt sledd Slackware 6 11-28-2004 05:59 PM
finished new installation DanoL Linux - Newbie 2 05-03-2004 08:39 PM
Un-finished Install bigalusn Linux - Newbie 4 09-25-2003 07:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration