On Thursday, October 8, 2015 at 7:16:34 PM UTC-4, John Brock wrote:
>
> I'm trying to construct a command containing double quotes, e.g.: scp
> "StrictHostKeyChecking no" source [email protected]:~
>
> However, I can't figure out how to escape the double quotes when using the
> julia backtick syntax. For example, none of the following work:
>
> julia> `scp "StrictHostKeyChecking no" source [email protected]:~`
> `scp 'StrictHostKeyChecking no' source [email protected]:~`
>
First, are you sure you actually want to pass double quotes to `scp`?
Double quotes are used in the shell to prevent spaces from being parsed as
separate arguments, they aren't actually passed to `scp`. The above
example is correct if you want to pass
StrictHostKeyChecking no
as the first argument of scp, and is equivalent to
scp "StrictHostKeyChecking no" source [email protected]:~
in a shell like bash.
If you actually wanted to pass double quotes to `scp` as part of the
arguments, you would escape them exactly a you would declare a literal
string with quotes in Julia:
*julia>* `scp "\"StrictHostKeyChecking no\"" source [email protected]:~`
`scp '"StrictHostKeyChecking no"' source [email protected]:~`
--SGJ