[SOLVED] Simple Nautilus shell script driving me nuts!
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I hard coded the selected file into the script and ran it with debugging and it worked, but it won't work as a Nautilus shell script.
I modified the script slightly and added the mv line at the end to attempt to force a name change after the conversion is done. The conversion works OK but the mv line is never executed. I'm flummoxed!
#! /bin/bash
FILE=$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sed q)
$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS returns the full path to the file so your output file name would be
conv./path/to/file/name.ext.mp4
Slashes are illegal characters in file names which is why your script does not work. If you desire to have your file named as conv.filename.mp4 then you need to strip the path and filename first and recombine it so it looks like
$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS returns the full path to the file so your output file name would be
conv./path/to/file/name.ext.mp4
Doh! THAT must be why the variable has the word PATH in its name. I'm afraid that was too obvious for me. Here I was looking for some really obscure "feature" of bash. Many thnks for the link to the tutorial.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.