LinuxQuestions.org
Review your favorite Linux distribution.
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 07-09-2010, 07:37 PM   #1
fw12
Member
 
Registered: Mar 2006
Distribution: Fedora core, Ubuntu
Posts: 175

Rep: Reputation: 31
Script syntax error


Please tell me why my script won't run, with the error:

-------------error-------------

test: 10: -gt: unexpected operator
video_encode_restart.sh: 15: [0: not found

-------------error-------------


--------------script--------------

#!/bin/sh

APPIP=`pidof ffmpeg2theora`
if test $APPID -gt 0
then
kill `pidof ffmpeg2theora`
fi

if [$? -eq 0]
then
ffmpeg2theora /dev/video0 -audiobitrate 128 --optimize ...
fi

------------------script---------------------

What I'm trying to do is restart ffmpeg2theora every so often. So I put above script in cron.

Last edited by fw12; 07-09-2010 at 07:38 PM.
 
Old 07-09-2010, 08:39 PM   #2
lucmove
Senior Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian
Posts: 1,432

Rep: Reputation: 110Reputation: 110
Do you realize you misspelled APPID?

Quote:
Originally Posted by fw12 View Post
APPIP=`pidof ffmpeg2theora`
if test $APPID -gt 0
Anyway, this script seems to work:

Code:
#!/bin/sh

APPID=`pidof ffmpeg2theora`
if 	[ "$APPID" != "" ]
	then
	kill "$APPID"
fi

if 	[ "$?" -ne "0" ]
	then
	ffmpeg2theora /dev/video0 -audiobitrate 128 --optimize ...
fi

Last edited by lucmove; 07-09-2010 at 08:40 PM.
 
Old 07-09-2010, 10:26 PM   #3
fw12
Member
 
Registered: Mar 2006
Distribution: Fedora core, Ubuntu
Posts: 175

Original Poster
Rep: Reputation: 31
Indeed APPID is misspelled. Thank you.
 
Old 07-10-2010, 01:31 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Please mark as SOLVED if you have your solution.
 
  


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
syntax error in firewall script tkmsr Linux - Networking 9 04-19-2010 11:12 PM
syntax error in VERSION script shariefbe Linux - Software 0 02-16-2010 10:44 PM
perl script syntax error matt007 Programming 2 09-17-2009 11:00 AM
why am getting error ksh: syntax error: `fi' unexpected while running script deb4you Linux - Newbie 4 09-06-2008 08:37 AM
Bash script syntax error snowman81 Programming 5 11-16-2007 02:35 AM

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

All times are GMT -5. The time now is 10:33 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