LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Running a script file (https://www.linuxquestions.org/questions/linux-newbie-8/running-a-script-file-46087/)

johnlb 02-19-2003 12:44 AM

Running a script file
 
I am running Suse 8.0 with bash. I created a script file that is a series similar to:

mv file1.jpg dir1
mv file2.jpg dir5
mv file3.jpg dir2
...
mv file199.jpg dir3

The file was created under Windows ME using javascript within a .hta file. This was done because the origial files are all on a fat32 partition with a javascript file listing them along with image pixel sizes. I had to reference that javascript file to determine where the files should be moved to based on height/width ratio.
Also, the file names are about 10 charactes without extention and very random in structure.

I moved the image files and the script file to Linux under /usr/local/mydir and then created the destination directories below that. I used chown and chmod so that all of the directories and the script files are owned by my non-root login, with rwx access to owner and root. When I type in the script file, it says 'command not found' with BOTH my login and as superuser.

I opened the script file in joe and it does not appear to have any DOS newline problems. I made the same test with less and it also had no strange characters displayed.

I also manually entered one of the lines on the keyboard exactly as it is listed in the script file and it worked. I am very unwilling to type it in for all files. I would rather do a drag and drop in Windows, as horrible as that sounds.

Why is the script file not working?

PTBmilo 02-19-2003 01:10 AM

Re: Running a script file
 
Quote:

Originally posted by johnlb
When I type in the script file, it says 'command not found' with BOTH my login and as superuser.

Did you type in the absolute path to the file, or just the name of it? If you are in the directory that it's in, you need to do './<script>' to make the shell look in the current directory for the executable.

.... that's all I can think of.

johnlb 02-19-2003 03:17 AM

That solved the problem.
Thanks
John


All times are GMT -5. The time now is 08:29 PM.