onepub-dev / dcli

An extensive library and tooling for building console/cli applications and scripts using the Dart programming language.
242 stars 28 forks source link

quoting for scp call #105

Open bsutton opened 4 years ago

bsutton commented 4 years ago

I had the following call to scp:

'scp $oldHost:/etc/asterisk/sip.d/* $tmpRoot/'.run;

The call failed as the '*' was being expanded locally and we ended up with a fully qualified path of the form:

`scp /home/me/www.microsoft.com.au:/etc/asterisk/sip.d/* /remote/path'.run.

I got around this problem by quote the local path:

'scp $oldHost:"/etc/asterisk/sip.d/*" $tmpRoot/'.run;

However this dones't feel right.

Maybe we need to reconigize the presense of the ':' or perhaps any other non-path character and then do the expansion.

Of course in this case any expansion of the '*' is wrong (as its meant to be a path on the remote system).

We need to have a look at how bash is handling this situation and provide an equivalent implementation.