LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Shell script to start MPlayer doesn't work in any other directory than /root (https://www.linuxquestions.org/questions/programming-9/shell-script-to-start-mplayer-doesnt-work-in-any-other-directory-than-root-439454/)

lagu2653 04-27-2006 03:46 PM

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

Vagrant 04-27-2006 03:55 PM

What error do you get? Whare the full permissions for your shell script and name.mpg?

lagu2653 04-27-2006 04:31 PM

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.

Dark_Helmet 04-27-2006 04:40 PM

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.

lagu2653 04-28-2006 02:57 AM

#!/bin/sh
#

mplayer name.mpg

lagu2653 04-28-2006 03:22 AM

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.


All times are GMT -5. The time now is 03:45 AM.