470,833 Members | 1,461 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

Folder name with "&" not getting created with ssh in perl

Hi All,
I am trying to create a folder with "&" in itz name (Ex: TS_&_ABC) with the help of perl's ssh command in another server. The exact command I am triggering in the code is

ssh("-i",$identity_file,"abc.abc.net","mkdir -p /opt/abc/mailboxes/mail/TS_&_ABC");

This creates a folder "TS_" but throws up an error
sh: line 1: _ABC: command not found.

We have already tried enclosing the folder name with single-quotes like
ssh("-i",$identity_file,"abc.abc.net","mkdir -p /opt/abc/mailboxes/mail/'TS_&_ABC'");

Apart from this we had also tried by putting a backslash before the "&"
But no use.

Please help how we can escape the "&" symbol in the perl's ssh command.

Thanks in advance

Aug 8 '08 #1
4 1569
Hi Anand,

Escaping with backslash is working fine when I tried on my SSH

Aug 8 '08 #2
Hi Anand,

Try escaping "&" with \backslash

Expand|Select|Wrap|Line Numbers
  1. mkdir TS_\&_ABC
You need to escape with \backslash when you want to remove this dir.

Aug 8 '08 #3
I tried out as u said , with a backslash.

ssh("-i",$identity_file,"abc.abc.net","mkdir -p /opt/abc/mailboxes/mail/TS_\&_ABC");

It made no difference ,it created a folder TS_

and throwed up an error as _ABC command not found.

Please revert with suggestions.

Aug 8 '08 #4
4,059 Expert 2GB
as suggested on another forum, try using two backslashes:

Aug 8 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

23 posts views Thread by ian justice | last post: by
4 posts views Thread by barney | last post: by
5 posts views Thread by martin | last post: by
7 posts views Thread by DC Gringo | last post: by
1 post views Thread by EoRaptor013 | last post: by
7 posts views Thread by Kirt | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.