[SOLVED] Basic Scripting Problem - What am I doing wrong?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Thank you both for the suggestions on the text editor on windows. This is probably a really dumb question, but could I open the script files up on my work computer, edit it, and save it again(on a windows) and have that "possibly" eliminate this issue?
Thank you both for the suggestions on the text editor on windows. This is probably a really dumb question, but could I open the script files up on my work computer, edit it, and save it again(on a windows) and have that "possibly" eliminate this issue?
Thanks again for everyone's help.
Any editing on a Windows machine will inject the wrong line endings into the file (unless you use one of those editors that can be configured to use Unix line endings, like Notepad++), and require you to run dos2unix on the file before it can be used on a Linux system. I don't believe any of those editors that can be configured to use Unix line endings will fix a previously-created file that uses the wrong ones though, it's best to just run dos2unix on it and fix it outright, and from then on make sure to only use editors that use Unix line endings.
Last edited by suicidaleggroll; 11-24-2015 at 02:33 PM.
Any editing on a Windows machine will inject the wrong line endings into the file (unless you use one of those editors that can be configured to use Unix line endings, like Notepad++), and require you to run dos2unix on the file before it can be used on a Linux system. I don't believe any of those editors that can be configured to use Unix line endings will fix a previously-created file that uses the wrong ones though, it's best to just run dos2unix on it and fix it outright, and from then on make sure to only use editors that use Unix line endings.
You can see if a file has the ^M at the end of a line using:
Code:
cat -v textfile
Notepad++ can remove them. Go to the Edit menu, select EOL Conversion, then select UNIX/OSX Format. Save the file and the hidden characters will be gone.
it's best to just run dos2unix on it and fix it outright, and from then on make sure to only use editors that use Unix line endings.
Also, I'd highly recommend avoiding spaces in file/dir names if possible.
The default *nix convention is that params passed to a program are space separated ... from which you can see that spaces cause issues on *nix.
As for the "TV[]", that's probably some kind of ctrl char you've managed to accidentally add.
Try renaming it, but that might be tricky, or move the contents, then delete it and recreate it.
Thanks to everyone here that helped and offered suggestions. You guys completely rock!
So I 86'd the written scripts, brought my laptop in to the office with me and wrote out a new one on linux. (I also added dos2unix to my machines)
So I set up the scheduler and went to work.
I have just checked, it appears to have exited with code 0, and it looks like it worked. Now, on to the removal of the extra files, and then set up something similar where a random playlist is copied over to my phone from my media centre for my daily commute.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.