passing double backslash(\\) as a path in unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting passing double backslash(\\) as a path in unix
# 1  
Old 03-04-2011
passing double backslash(\\) as a path in unix

Hi All,

I am trying to add a tag in the *.imp file.

This is a piece of code which I am giving in my template file and my script reads this template file attachment and passes to windows server(as they have provided the below file path).

@*@ATTACHMENT@*@:\\Appl051a\e\ftproot\Infoman_import\live\file.csv

in unix, When I am passing this in a template file as per the above expected code as below,

@*@ATTACHMENT@*@:"\\\\Appl051a\\e\\\\ftproot\\Infoman_import\\live\\file.csv"

here by passing extra (single \ backslash) the unix identifies a single slash,

now here is the problematic part,

Eventhough I have given,

@*@:"\\\\Appl051a extra backslashes, but it still detects as one single backslash as below in the output imp file,

@*@ATTACHMENT@*@:"\Appl051a\e\ftproot\Infoman_import\live\file.csv"

Only one single backslash is being taken.

Please can any one help me in identifying how I can resolve this by making it start with
@*@ATTACHMENT@*@:"\\Appl051a

Thanks in Advance,
# 2  
Old 03-04-2011
use single quotes.

Code:
echo '\\\\Appl051a\\e\\\\ftproot\\Infoman_import\\live\\file.csv'

# 3  
Old 03-04-2011
Personally I'd hold such a filename in a flat text file and avoid unix Shell interpreting the filename by using "cat" instead of "echo" or whatever is appropriate to your process.


Beware with the bckslash approach that it will behave differently from within a Shell script compared with the command line. Always test from a Shell script.
# 4  
Old 03-09-2011
Thanks anchal_khare and methyl.

I have used while read -r textline and it has indeeed worked out.

Thanks for your prompt reply.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Passing variables from UNIX to Ansible to UNIX shell

I m passing a variable stringg from Unix shell which has value 'Good Day' to ansible and from ansible to a second shell script where it print only Good instead of 'Good Day' passing the variable stringg from unix shell script1.sh echo $stringg ansible-playbook install.yml -i... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. Shell Programming and Scripting

[BASH] Getting a semi-tailing backslash when passing (escaped) variables to script

Heyas Figured me had a 'typo' in tui-conf-set, i went to fix it. Now, i also figured, it might be nice to have tui-conf-set report (to console, not only exit code) wether it could save the variable to the file or not. This said, I appended this code: (the tui-title and tui-echo lines are... (3 Replies)
Discussion started by: sea
3 Replies

3. Shell Programming and Scripting

Passing backslash character to awk variable

Hi All. I have a file that contains some special characters and I'm trying to use AWK to search for lines between <pattern1> and <pattern2>. As an example: I need the lines between the line containing ' select_id="x_0 ' and the line containing the next instance of ' from '. This is a file... (5 Replies)
Discussion started by: Mudshark
5 Replies

4. Programming

Passing full path as argument when it contains variable strings

Hi, In directory "inoutfiles", I have folders fold0001, fold0002 and so on. Every folder has corresponding file file0001.txt, file0002.txt and so on. I want to perform a certain action on multiple files in one go. The cpp file is in the same directory as "inoutfiles". This is my code : ... (1 Reply)
Discussion started by: KidD312
1 Replies

5. UNIX for Advanced & Expert Users

Passing full path as argument when it contains variable strings

Hi, In directory "inoutfiles", I have folders fold0001, fold0002 and so on. Every folder has corresponding file file0001.txt, file0002.txt and so on. I want to perform a certain action on multiple files in one go. The cpp file is in the same directory as "inoutfiles". This is my code : ... (0 Replies)
Discussion started by: KidD312
0 Replies

6. Shell Programming and Scripting

Why double quotation marks doesn't work in ksh function parameters passing?

I'm working on AIX 6, ksh shell. The parameters are some strings quotated by double quotation marks which from a file. They are quotated because there may be spaces in them. Example: "015607" "10" " " "A"I want to pass these parameters to a shell function by writing the following command: ... (4 Replies)
Discussion started by: Shimmey
4 Replies

7. Shell Programming and Scripting

How to replace spaces excluding those within double quotes and after backslash?

In bash or perl, I would like to know how to substitute a null character (0x00) for every white space without changing the white spaces inside the block of double quotes and the white space immediately following a backslash. Suppose that sample.txt consists of the following line. "b 1" c\ 2 ... (2 Replies)
Discussion started by: LessNux
2 Replies

8. Shell Programming and Scripting

specified path name is too long passing parameters to awk via shell script

Hello, I have this shell script that runs awk code by passing in parameters however now it doesn't work anymore with the parameters and I don't know why. It removes duplicates from an input file based on a part of the last field and a key column. It removes the record with the older datetime... (0 Replies)
Discussion started by: script_op2a
0 Replies

9. Shell Programming and Scripting

double backslash in ksh

Hi I need the "\\hello" (without double quotes) to be written to a file. echo "\\\\hello" >file is working under bash shell but not working under ksh shell (gives only one / in the output) Please advise. TIA Prvn (4 Replies)
Discussion started by: prvnrk
4 Replies

10. UNIX for Advanced & Expert Users

missing Path(in UNIX) when i launch a job on to unix machine using windows SSh

hi i want run an unix application from a windows program/application.i am using SSH(command line version)to log on to a unix machine from windows. the application has to read a configuration file inorder to run. the configuration file .CFG is in bin in my home directory. but the application... (1 Reply)
Discussion started by: megastar
1 Replies
Login or Register to Ask a Question