Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 8th, 2008, 01:25 PM
Newbie
 
Join Date: Dec 2007
Posts: 3
Default 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

Regards,
Anand.
Reply
  #2  
Old August 8th, 2008, 02:41 PM
Newbie
 
Join Date: Jul 2008
Posts: 14
Default Folder name with "&"

Hi Anand,

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

-Chiku

Last edited by chiku1523; August 8th, 2008 at 02:53 PM. Reason: Posted this twice
Reply
  #3  
Old August 8th, 2008, 02:44 PM
Newbie
 
Join Date: Jul 2008
Posts: 14
Default

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.

-Chiku
Reply
  #4  
Old August 8th, 2008, 03:18 PM
Newbie
 
Join Date: Dec 2007
Posts: 3
Default

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.

regards
sudarshan
Reply
  #5  
Old August 8th, 2008, 06:33 PM
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Posts: 3,662
Default

as suggested on another forum, try using two backslashes:

\\&_ABC"
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles