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 |
What error do you get? Whare the full permissions for your shell script and name.mpg?
|
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. |
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. |
#!/bin/sh
# mplayer name.mpg |
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. |