View previous topic :: View next topic |
Author |
Message |
mgladding4423 n00b
Joined: 12 May 2005 Posts: 15
|
Posted: Tue Jul 18, 2006 4:59 pm Post subject: SSH Remote commands and single quotes |
|
|
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 |
|
|
mgladding4423 n00b
Joined: 12 May 2005 Posts: 15
|
Posted: Tue Jul 18, 2006 5:15 pm Post subject: |
|
|
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 |
|
|
|