Hey folks, thanks for the replies, very helpful.
Third: Why do a script from crontab with
cp cputest_donotremove.txt "/apps/opt/archive/tmp/demo/staging/encrypt01.tmp"
cp cputest_donotremove.txt "/apps/opt/archive/tmp/demo/staging/encrypt02.tmp"
cp /tmp/cputest_donotremove.txt /apps/opt/archive/tmp/demo/staging/encrypt01.tmp
The actual source path is /apps/fileport/opt/archive/tmp/demo/staging/ and the target is
I just framed the question using tmp to avoid the response of someone asking to make sure the path is correct and in right case and so forth. So I just said /tmp to get around that.
The script when I use the cp command
cp /apps/fileport/opt/archive/tmp/demo/staging/encrypt01.tmp /apps/fileport/opt/archive/tmp/demo/inbound/encrypt01.tmp
is too long to fit on one line as you can see here and so for some God forsaken reason a /r gets appended to the target file so I end up with a file that looks like encrypt01.tmp? when I do an ls on the directory and it looks like encrypt01.tmp/r when I do a dir on the directory.
In other words the cp statment in the script has a return character and that becomes part of the target file name.
So to get around that whole mess I added the cd statement before the cp statment so that I could fit the cp on one line. I even tried making variables at the top of the script source=/apps/fileport/opt/archive/tmp/demo/staging/encrypt01.tmp and then using $source and got the same problem No such file or directory so when I edit the script in vi, and copy the path to the clipboard for sanity check, it works fine but when it is in the script, I get the No such file or directory. Strange.
I used cat -vte ./movefiles.sh to see if there were any nonviewable characters in the script and there weren't any. No trailing spaces on any line just the $ after the last character in the cd statment. Also I used dos2unix after moving the file over from notepad > filezilla client > Linux server. No change in result.
One thing I noticed was the error message looked like: No such file or directoryapps/fileport (where it hacked off the leading slash, it's as if it's treating the slash in front of apps like an escape character or something. I will give #!/bin/bash a try and see if that changes anything .
No more all nighters on this one, I'm desperate!!
Any ideas? What is a newb to do