Class RemotePathTransformation
- Namespace
- Renci.SshNet
- Assembly
- Renci.SshNet.dll
Provides access to built-in remote path transformations.
public static class RemotePathTransformation
Inheritance
Inherited Members
Remarks
References:
- Shell Command Language
- Unix C-Shell special characters and their uses
- Differences Between Bourne and C Shell Quoting
- Everyone quotes command line arguments the wrong way
Properties
DoubleQuote
Gets a Renci.SshNet.IRemotePathTransformation that encloses a path in double quotes, and escapes any embedded double quote with a backslash.
public static IRemotePathTransformation DoubleQuote { get; }
Property Value
Examples
Original | Transformed |
---|---|
/var/log/auth.log | "/var/log/auth.log" |
/var/mp3/Guns N' Roses | "/var/mp3/Guns N' Roses" |
/var/garbage!/temp | "/var/garbage!/temp" |
/var/would be 'kewl'!, not? | "/var/would be 'kewl'!, not?" |
"" | |
Hello "World" | "Hello \"World" |
None
Gets a Renci.SshNet.IRemotePathTransformation that performs no transformation.
public static IRemotePathTransformation None { get; }
Property Value
Remarks
Recommended for servers that do not require any character to be escaped or enclosed in quotes, or when paths are guaranteed to never contain any special characters (such as #, ", ', $, ...).
ShellQuote
Gets a Renci.SshNet.IRemotePathTransformation that quotes a path in a way to be suitable to be used with a shell-based server.
public static IRemotePathTransformation ShellQuote { get; }
Property Value
Examples
Original | Transformed |
---|---|
/var/log/auth.log | '/var/log/auth.log' |
/var/mp3/Guns N' Roses | '/var/mp3/Guns N'"'"' Roses' |
/var/garbage!/temp | '/var/garbage'\!'/temp' |
/var/would be 'kewl'!, not? | '/var/would be '"'"'kewl'"'"\!', not?' |
'' | |
Hello "World" | 'Hello "World"' |
Remarks
If a path contains a single-quote, that character is embedded in quotation marks (eg. "'"). Sequences of single-quotes are grouped in a single pair of quotation marks.
An exclamation mark in a path is escaped with a backslash. This is necessary because C Shell interprets it as a meta-character for history substitution even when enclosed in single quotes or quotation marks.
All other characters are enclosed in single quotes. Sequences of such characters are grouped in a single pair of single quotes.