Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IS THERE A PROBLEM WITH PATHWAYS, eg. "\\xxx\yyy"?? 1

Status
Not open for further replies.

PrgrmsAll

Programmer
Apr 8, 2003
180
US
I am appending lines to a file ($MESSAGE) and then attaching the file to an email. One of the lines is a network pathway string. However, I am having issues with it. The following code:

echo "<\\server1\dept\share\transfer>" >> $MESSAGE

produces:

<\server1\dept\share ransfer>

Can anyone tell me what I am doing wrong?

Thank you in advance.
 
You need, would you believe to write it like this.

echo "<\\\\\server1\\dept\\share\\\transfer>"

Unix doesn't really *do* backslashes in pathnames, and the \t was being interpreted as a TAB character.

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Mike, thanks once again. I was a Gupta SQLWindows Programmer for about 18 months and that RAD Environment also behaved similarly. That is great to know.

Thanks again.
 
PrgrmsAll,

That is because of the way the shell interprets it. To get the result you are looking for, try:

echo '<\\\server1\\dept\\share\\transfer>'

man ksh and read about escaping.

\ Escape next character. Editing characters, the user's erase, kill and interrupt (normally ^?) characters can be entered in a command line or in a search string if preceded by a \. The \ removes the next character's editing features (if any).

John
 
I have a job that calls another job. The second job sets up
a textfile and emails it to a recipient list. It all works great.
The only thing I am having bother with (now that I sorted out
the \\ issues (thanks!)) is passing a file name from the first
job to the second one. Let me give an example:

============================================================
JOB_1.sh
============================================================
/home01/userme/jobs/job1.eml
============================================================

============================================================
JOB_1.eml
============================================================

rm email1.txt
MESSAGE="email1.txt"
TO="123@xyz.com"
CC="456@xyz.com 789@xyz.com"
echo ~c "$CC" >> $MESSAGE
echo ~s "File Transfer: Successful" >> $MESSAGE
echo "The file created by JOB1 is now ready. It is located in the
following directory:" >> $MESSAGE

echo "<\\\\\server1\\dept\\share\\\transfer\\>" >> $MESSAGE

echo "" >> $MESSAGE
echo "The process date & time was:" >> $MESSAGE
date '+DATE: %m/%d/%y%nTIME: %H:%M:%S' >> $MESSAGE
echo "" >> $MESSAGE
echo "If you are receiving this email in error or need to request a
change, please submit a Change Request." >> $MESSAGE

mailx -s $SUBJECT $TO < $MESSAGE
============================================================

My issue is that I want to add a filename onto the end of the path.
This will be different everytime. Typically a JobName + JulianDate + .xls.

When calling 'job1.eml' from 'job1.sh', is there a way I can pass the
filename as a parameter?



Thank you.

 
PrgrmsAll,

If the other script you are using accepts the filename parameter, you just have to define the variable.

I.E.

TODAY=`date +%m%d%y`
/home01/userme/jobs/job1.eml $TODAY.xls

John
 
Thanks John. Currently the second script is not expecting nor accepting anything. How do I set that up? Just simply by defining the variable in there (by 'there' i mean JOB1.eml)?
 
Depending on how your script is set up, you could just set a variable equal to $1.

Ex.

#!/usr/bin/ksh

if [ $1 ]; then
ABC=$1
else
echo "\nThis script requires a date parameter\n"
exit 1
fi

If you post your script, that could help us determine what changes need to be made.

John
 
I have the variable/parameter part working, I am just have problems with concatenating strings. I thought the double-pipe combination did this ( Hello || World ) but this is not working. I actually want to do something like:

$TODAY + ".xls" + $ABC (where the + is a concatenation).

Surely I am missing something easy here?

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top