LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-26-2009, 10:52 PM   #1
anonguy9
LQ Newbie
 
Registered: Mar 2009
Posts: 25

Rep: Reputation: 16
Pasting a block of commands, handling delayed programs (ffmpeg)


I'm not sure how to search for this. I've tried some stuff off the top of my head but without any luck.

I have some medium sized scripts which I want to be able to paste in bulk into a terminal.

However, these scripts will halt when ffmpeg is run. Nothing after that pasted command is used. This is because ffmpeg sits there and spins its wheels.

- If put into a script, everything would work fine.
- If the copy-and-paste did each ffmpeg in turn it would be ok.
- But is there a sensible way for me to modify my code so that it's more paste friendly?

Something like this non-functioning code perhaps?:

Code:
echo other stuff
echo other stuff
ffmpeg foo&&\
echo other stuff
ffmpeg foo&&\
echo other stuff
ffmpeg foo&&\
echo other stuff
 
Old 03-27-2009, 12:14 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Why not paste it into a script?

e.g.
cat >script
<PRESS PASTE HERE>
..
..
<THEN PRESS CTRL-D>
 
Old 03-27-2009, 09:12 AM   #3
anonguy9
LQ Newbie
 
Registered: Mar 2009
Posts: 25

Original Poster
Rep: Reputation: 16
Quote:
Why not paste it into a script?
Because that's more keystrokes than I want. =)

-

I did some thinking, and I realised that ffmpeg is running in an interactive mode (q to quit). This explains things. So ffmpeg is trying to be smart and it sees that I'm at a commandline.

This message from Aug 2006 says that there is no way to force non-interactive mode. So far I haven't been able to confirm or deny that.

I'll check with the ffmpeg people about this. (link / thread)


So I guess the only solution would be to have some kind of cat helper-prompt thing which will accept pasted input and will run that script.

Code:
TEMP=/tmp/test.$PPID && cat - > $TEMP && bash $TEMP && rm -f $TEMP
If I could wrap that into my actual physical bash prompt, that would be pretty sweet. I'll research that for a bit.

Last edited by anonguy9; 03-27-2009 at 01:32 PM.
 
Old 03-27-2009, 01:31 PM   #4
anonguy9
LQ Newbie
 
Registered: Mar 2009
Posts: 25

Original Poster
Rep: Reputation: 16
AHA!

Appending this to the end of an interactive program will force it back into non-interactivity.

Code:
>/dev/null 2>/dev/null </dev/null
So now I can paste blocks of code with multiple non-interactive programs. Awesome!
 
  


Reply

Tags
background, commandline, commands, delay, ffmpeg, force, interactive, job, jobs, mode, noninteractive, paste, program, task


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to block certain programs to linux users iinfi Linux - Desktop 2 01-23-2009 02:04 PM
what is a good program for handling input and executing programs? kev717 Linux - General 2 09-15-2008 02:09 PM
Handling Errors and exceptions of commands pdklinux79 Linux - Newbie 1 06-20-2008 02:28 PM
Sound: programs block each other adrianmariano Linux - General 2 09-18-2007 04:31 PM
Need help w/ shell handling 3 commands/2 pipes sptchamp Programming 3 07-15-2004 09:37 PM


All times are GMT -5. The time now is 05:53 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration