Your skill will accomplish
what the force of many cannot
Getting information about a remote file via SSH: how to escape the filenameby jonadab (Parson)
|on Jun 27, 2013 at 11:48 UTC||Need Help??|
jonadab has asked for the
wisdom of the Perl Monks concerning the following question:
Ok, it's been a while since I've been this stumped on a Perl question and resorted to asking for help.
Ultimately, what I'm trying to accomplish here is to get information on any given remote file. I have access to the remote system via ssh and know the file's full path: call that $remotefile
The approach I was thinking of using is like so:
But I can't rule out the possibility that the remote filename might contain shell metacharacters.
My immediate thought was, "No problem, I'm sure the CPAN has six different modules for escaping shell metacharacters," but all I seem to be able to find is modules that appear to be intended for escaping strings in program source code (notably, String::Escape) or undoing said escaping (Encode::Escape for instance). To the best of my knowledge, those probably won't do entirely the right thing (e.g., with spaces). Am I correct in assuming that I need something different?
The characteristics of the remote system are known, and are essentially the same as the local system, although they get updates at different times. (Both systems are Debian.)
Thoughts? Other approaches?
We're working on a multi-year set of freely redistributable Vacation Bible School materials.