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 04-27-2006, 03:46 PM   #1
lagu2653
Member
 
Registered: Jun 2005
Distribution: Lubuntu 16.04 LTS
Posts: 104

Rep: Reputation: 15
Shell script to start MPlayer doesn't work in any other directory than /root


I'm trying to make a shell script to make MPlayer start playing a film at a certain point into the film. I.o.w.
mplayer name.mpg -ss 00:30:43 -fs
It works in the root directory when I log in as root but no other directory I've tried. The program to open the shell script has been set to bash and the execution rights are there otherwise it wouldn't work even in the /root directory.

ss stands for seek and fs stands for full screen
 
Old 04-27-2006, 03:55 PM   #2
Vagrant
Member
 
Registered: Nov 2001
Posts: 75

Rep: Reputation: 15
What error do you get? Whare the full permissions for your shell script and name.mpg?
 
Old 04-27-2006, 04:31 PM   #3
lagu2653
Member
 
Registered: Jun 2005
Distribution: Lubuntu 16.04 LTS
Posts: 104

Original Poster
Rep: Reputation: 15
Errors, permissions etc.

permissions: script: rwxrwxrwx name.mpg: rwxrwxrwx
Errors: I double-click it in Konqueror or on the desktop and nothing happens
If I type # sh scriptname.sh
mplayer starts fine (OBS! in all directories of the whole file system I think. All I've tried at least.) but when I close it nothing comes up in the shell window when I type. But when I type return the text shows on the line above. So it's like using the shell blindly without seeing what you type.

Also if I login as user the script works in my user directory and nowhere else when double clicked in Konqueror.

Last edited by lagu2653; 04-27-2006 at 04:40 PM.
 
Old 04-27-2006, 04:40 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Posting the contents of the script would be helpful. At the very least, we could suggest where to add debugging statements.

BTW, by giving the script execute permissions for everyone, you don't need to execute it as "sh script_name" - you can simply do "/path/to/script_name" or "./script_name". That requires "#!/bin/bash", "#!/bin/sh", or the appropriate interpreter as the first line of the script though.
 
Old 04-28-2006, 02:57 AM   #5
lagu2653
Member
 
Registered: Jun 2005
Distribution: Lubuntu 16.04 LTS
Posts: 104

Original Poster
Rep: Reputation: 15
#!/bin/sh
#

mplayer name.mpg
 
Old 04-28-2006, 03:22 AM   #6
lagu2653
Member
 
Registered: Jun 2005
Distribution: Lubuntu 16.04 LTS
Posts: 104

Original Poster
Rep: Reputation: 15
If I use the whole explicit path it works when double-clicked in Konqueror:

mplayer /home/username/Desktop/name.mpg

but

#!/bin/sh
a=`pwd`
echo $a/name.mpg
mplayer $a/name.mpg

echoes the right path and starts mplayer when run in a shell window. But mplayer won't start when the script is double-clicked in Konqueror.

Last edited by lagu2653; 04-28-2006 at 03:33 AM.
 
  


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
How to change directory in a shell script? jdupre Linux - Newbie 13 06-25-2015 05:03 AM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
shell script: delete all directories named directory.# except directory.N brian0918 Programming 3 07-13-2005 06:54 PM
directory renaming shell script? Apostasy Linux - General 15 02-22-2005 06:50 AM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM

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

All times are GMT -5. The time now is 11:12 PM.

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