Operating System - HP-UX
1748266 Members
3119 Online
108760 Solutions
New Discussion юеВ

Re: Problems with backslashes in script being translated incorrectly

 
Chris Hulihan
Advisor

Problems with backslashes in script being translated incorrectly

Does anyone have experiences with using a series of backslashes that cancel themselves out to equal one?

I have a user that created ftp scripts two years ago to access a win2k ftp server -- all of a sudden this "broke" and although I could not see OS changes, etc. that would cause this, I'm not really comfortable in expecting these to work as expected.

The backslashes are used like this :
MYDIR=\\\\dir1\\\\dir2\\\\

Does anyone use these in scripts? I did tell the user to just use forward slashes, but they are reluctant to change anything that has worked for 2 years. Plus, I haven't found a lot of information about using backslashes in such a manner... I was hoping either that someone would have experience (either positive or negative) or other tricks & information so that I can firmly recommend my proposed changes to the script. I looked for quite some time but did not see much information about the subject.

Thanks!!!
5 REPLIES 5
RAC_1
Honored Contributor

Re: Problems with backslashes in script being translated incorrectly

I expected to see MYDIR=\\\\dir1\\dir2
instead of MYDIR=\\\\dir1\\\\dir2\\\\

Does it give any error??
There is no substitute to HARDWORK
Jeff_Traigle
Honored Contributor

Re: Problems with backslashes in script being translated incorrectly

With no errors to go on, it's tough to say for sure... but, if there were no OS changes and the script didn't change, then it stands to reason that something changed on the Win2k system or maybe some network change that effected communication between the systems. Definitely need more detail to give a better idea of the problem though.
--
Jeff Traigle
Chris Hulihan
Advisor

Re: Problems with backslashes in script being translated incorrectly

What they're doing is this :
ftp -i -n <<-%% > $OUTFILE 2>&1

open $SERVER
user $USERID $PASSWD
$TYPE
cd $REMOTEDIR
$CMD $ARG1 $ARG2
bye
%%

Basically, they're saying $REMOTEDIR=\\\\dir1\\\\dir2\\\\
and calling the ftp script this way...
Chris Hulihan
Advisor

Re: Problems with backslashes in script being translated incorrectly

Here is the error message seen on the ftp server side :
"dir1dir2myfile.csv: The system cannot find the file specified."

Note, this problem is run by a batch system named locally as "maestro" which is actually a tivoli product (Tivoli Scheduler?). The script will run fine manually... which seems really strange.

I already forwarded this to the people that support the batch scheduling software, but they did not find anything conclusive. I was hoping that maybe someone would have had problems with using the backslash (or maybe tell me that this is pretty solid and have ideas for something else that I can look for)... I have looked through ftp client, kernel changes, etc. for anything that has changed since the last successful run of this script.
Sundar_7
Honored Contributor

Re: Problems with backslashes in script being translated incorrectly

Check the shell that Trivoli uses to run this script.

which shell do you use while executing this script from the command line ?

Edit the script and explicitly define the shell to use in the first line

#!/usr/bin/sh

and try again from the scheduler.

Consider defining REMOTEDIR as

REMOTEDIR="c:\dir1\dir2"
Learn What to do ,How to do and more importantly When to do ?