UPDATE: I found the answer to my question. I'll still post in case anyone is interested.
...
Hey all, I am working on code that downloads from a mirror of the VA patch server. And as Sam pointed out, I seem to have time at the end of the day on Friday to post questions. So why change the pattern?
I am having an issue where wget seems to be renaming my output file.
Here is my mumps wrapper for this:
WGET(URL,OPTIONS,DIR) ;
;"Purpose: Provide a shell for the linux command 'wget'
;"Input: URL -- the URL to download
;" OPTIONS -- the text of the options passed to wget
;" see linux documentation for details.
;" DIR -- the dir to download to. User must be able to
;" cd into this directory.
;"Results: result of the wget command. 0 = no problems
;" NOTE: other return values defined in linux docs.
NEW HOOKCMD,RESULT
SET HOOKCMD="cd """_DIR_""" && wget"
IF $GET(OPTIONS)'="" SET HOOKCMD=HOOKCMD_" "_OPTIONS
SET HOOKCMD=HOOKCMD_" """_URL_""""
ZSYSTEM HOOKCMD
SET RESULT=$ZSYSTEM&255 ;"result of execution. (low byte only)
QUIT RESULT
;
When I step through the code with a step-by-step debugger, this is HOOKCMD that is actually used, being passed to ZSYSTEM:
Here is a detailed listing of the /tmp/ directory after running the command..
:/tmp$ ls -Al
total 232
-rw-r--r-- 1 root root 67390 Jul 22 18:50 crontablog
-rw-rw-r-- 1 kdt0p kdt0p 14652 Jul 22 18:29 'FB-3p5_SEQ-149_PAT-158 - Copy.txt'
-rw-rw-r-- 1 kdt0p kdt0p 15020 Jan 22 2018 'FB-3p5_SEQ-149_PAT-158 - Copy.txt.1'
drwxrwxrwt 2 root root 4096 Jul 22 04:51 .font-unix
drwxrwxrwt 2 root root 4096 Jul 22 04:52 .ICE-unix
-rw-r--r-- 1 root root 48265 Jul 22 18:50 IncomingFaxLog
And just to be sure wrapping is not a problem, here is an abbreviated ls of the folder.
:/tmp$ ls
crontablog
'FB-3p5_SEQ-149_PAT-158 - Copy.txt'
'FB-3p5_SEQ-149_PAT-158 - Copy.txt.1'
IncomingFaxLog
Here I have run the command twice, and that is why one of them has a .1 at the end.
The problem is that the file name is wrapped with single quotes ('), which is NOT what I asked it to do. I think it has something to do with the spaces in the name. But this isn't anything I asked it to do. I know that single or double quotes are used to deal with spaces in names, when writing bash commands etc. But I haven't seen them end up in the stored filename.
This is causing a problem because I store the file, and then my code can't work with it because the name is slightly different (i.e. has added single quotes).
ANSWER
It shows that even though some linux distros are adding single quotes around names, they are not actually part of the name. Just the way it is displayed. And, in fact, I can reference the file without the single quotes, and everything works as expected.
So the issue I am having with my code, that led me down this rabbit hole, must be something else. (I am download a lot of files and 99% of the time it works fine. And then it will just hang when trying to run a linux head command on the downloaded file).
Thanks for listening.
Kevin