Re: Problems with backslashes in script being translated incorrectly (254 Views)
Reply
Advisor
Chris Hulihan
Posts: 25
Registered: ‎07-13-2003
Message 1 of 6 (254 Views)

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!!!
Honored Contributor
RAC_1
Posts: 5,920
Registered: ‎03-21-2002
Message 2 of 6 (254 Views)

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
Honored Contributor
Jeff_Traigle
Posts: 1,354
Registered: ‎03-04-2004
Message 3 of 6 (254 Views)

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
Advisor
Chris Hulihan
Posts: 25
Registered: ‎07-13-2003
Message 4 of 6 (254 Views)

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...
Advisor
Chris Hulihan
Posts: 25
Registered: ‎07-13-2003
Message 5 of 6 (254 Views)

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.
Honored Contributor
Sundar_7
Posts: 1,938
Registered: ‎11-07-2000
Message 6 of 6 (254 Views)

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 ?
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.