echo windows path


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers echo windows path
# 1  
Old 03-08-2012
echo windows path

I have developed a script that transfers files from a UNIX machine to a Windows machine. Transferring the files is working perfectly, but my echo statements are displaying the destination (Windows) path names incorrectly.

I understand that it is the "\" that is causing this, but is there anyway to get echo to display the path without interpreting the "\" ?

Here is an example script that demonstrates the problem:
Code:
export DEST_FILE="C:\\Reports\\tracelock.csv"
 
echo ${DEST_FILE}
echo "'"${DEST_FILE}"'"
echo "${DEST_FILE}"
echo '"'${DEST_FILE}'"'

None of the echo statements display the destination correctly. The \t always gets interpreted as a tab.
# 2  
Old 03-08-2012
Code:
n12:/home/vbe $ export DEST_FILE='C:\\Reports\\tracelock.csv'
n12:/home/vbe $ echo $DEST_FILE                              
C:\Reports\tracelock.csv

# 3  
Old 03-08-2012
Thank you for the prompt response. I have been concentrating so much on the echo statement that I didn't think about altering the way the string is stored in the environment variable.

However, I guess I am going to have to rethink how I am doing things. If I alter the variable as suggested, then the echo works fine but the transfer command doesn't like it. (I am attempting to use the same variable to echo to the screen and pass to the transfer command)

Example:
Code:
export SRC_FILE='/reports/source/tracelock.csv'
export DEST_FILE='C:\\Reports\\tracelock.csv'
 
echo IntrnTrans -s ${SRC_FILE} -d ${DEST_FILE}
IntrnTrans -s ${SRC_FILE} -d ${DEST_FILE}

This works for the echo statement, but the IntrnTrans program doesn't like it.
# 4  
Old 03-08-2012
What errors does he throw at you?
# 5  
Old 03-08-2012
It throws a communication error, but the log file for the IntrnTrans program states that "C:\\Reports\\tracelock.csv" is an invalid destination.

However, I have found another way that fixed the issue. I returned to setting the variables with double quotes, but when I echo the statement out I use "echo -E". My documentation states that "-E" disables interpretation of backslash escapes. The documentation also says that is the default, but it isn't behaving that way since I had to add it.

Thank you! I appreciate your help.
# 6  
Old 03-09-2012
just try with:

echo $dest_path
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh - variable to be set to windows path issue

Greetings Experts, I need to pass a parameter to ksh and the value is windows path eg: sh abc.txt C:\Users\chill3chee\Desktop No matter I try with \ delimiter, still could not get this exact value assigned to the shell variable which was checked with echo. Tried with using... (2 Replies)
Discussion started by: chill3chee
2 Replies

2. Shell Programming and Scripting

Using Perl to explore recursively remote windows path from AIX

Hi all, I am using Perl 5.8.8 on an Aix 6.1.0.0 to script a program which will retrieve files recursively on a remote Windows 2003 server and copy some of them on my Aix server. MobaSSH is installed on that windows server. When I used scp on the command line, it works fine, but not in a... (2 Replies)
Discussion started by: Fundix
2 Replies

3. UNIX for Dummies Questions & Answers

Need help to move .csv file from UNIX path to windows shared drive or c:\ drive

Hi Guys, Can any one help me on this. I need help to move .csv/.xls file from unix path to windows shared drive or c:\ drive? Regards, LKR (1 Reply)
Discussion started by: lakshmanraok117
1 Replies

4. UNIX for Dummies Questions & Answers

What is wrong with: echo $PATH | sed s/:/\\n/g

Hello all! I am on Mac (10.8.4) and my shell tcsh (man says version: Astron 6.17.00). Just to precise my tcsh: echo $LC_CTYPE UTF-8 I want to replace all ':' with a new line, to get all paths on one line. I don't find a way to make my shell accept the "\n" My start was: echo... (17 Replies)
Discussion started by: marek
17 Replies

5. Windows & DOS: Issues & Discussions

How to map a path to a drive in windows

Hi all, Can anybody explain me about mapping a path to a drive with example? Thanks (3 Replies)
Discussion started by: Bobby16
3 Replies

6. UNIX for Advanced & Expert Users

accessing NFS absolute path symlinks from windows/cygwin

Hi experts, I was wondering if there is a way to access some NFS symlink files that are set using absolute paths from Windows? On windows/cygwin, I'm able to access relative path symlinks but not the absolute path symlinks. Assume on Linux (mylinux): /usr/local/file.c ln -s... (1 Reply)
Discussion started by: andredz
1 Replies

7. Shell Programming and Scripting

SH echo$path

I need to run my shell script just by typing its name rather than doing sh <scrpit name>. I think its something to do with my profile and path. echo $path is giving me output as follows: sr/games /opt/gnome/bin /opt/kde3/bin /usr/bin/X11 /usr/local/bin /usr/bin /bin /usr/sbin /sbin... (3 Replies)
Discussion started by: 1MB
3 Replies

8. UNIX for Dummies Questions & Answers

echo $PATH doesn't match $HOME/.profile

This is on a Solaris 9 box, but I feel like a noob, so I am posting here. When I echo $PATH I get a lot of duplicate paths and extra stuff I don't need. What I want is just what I set up in my home dir under .profile My login shell=/bin/bash I checked the following and there are no path... (1 Reply)
Discussion started by: Veestan
1 Replies

9. Windows & DOS: Issues & Discussions

Path of Recycle Bin on Windows

hello everybody, I am trying to find the path of the Recycle Bin. I know that it's a temporary storage place, but it should have a path that we can refer to. I want to know it because I sometimes use cygwin to work on Windows, and when you delete something with it, it's gone. I just checked... (4 Replies)
Discussion started by: milhan
4 Replies
Login or Register to Ask a Question