Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SSH Remote commands and single quotes
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
mgladding4423
n00b
n00b


Joined: 12 May 2005
Posts: 15

PostPosted: Tue Jul 18, 2006 4:59 pm    Post subject: SSH Remote commands and single quotes Reply with quote

I'm trying to run an md5sum on a remote file from a perl script... problem is some of the files this sum will be run on are mp3s that have single quotes in the file name. I find that the single quote is terminating the single quote required to enclose the command for ssh. I tried using an addslashes subroutine to escape this single quote but it appears ssh doesn't allow for escaped single quotes? I get the follow error for this example:


Code:

server ~ # ssh storage 'md5sum "/export/mp3/Baz Luhrmann - Everybody\'s Free
(to Wear Sunscreen).mp3"'
-bash: syntax error near unexpected token `('


(yeah yeah, don't judge the mp3 it's the first example that this comes up with!)

Any clue what I need to do to escape this single quote and make it so this command is accepted through ssh but doesn't effect the filename?
Back to top
View user's profile Send private message
mgladding4423
n00b
n00b


Joined: 12 May 2005
Posts: 15

PostPosted: Tue Jul 18, 2006 5:15 pm    Post subject: Reply with quote

Never mind... I found that ssh can accept commands wraped in double quotes as well and double quotes can be escaped within double quotes.

Hope this may help someone in the future
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum