buildCommandLine

open fun buildCommandLine(command: Command): String

Given that a command is made up of an array of String parts, build the complete command line string. It is intended to be used with the unix shell "sh" and the many variants, such as bash, dash etc.

If the Feather script contained :

$( echo 'Hello $name' )

Then there are THREE parts e.g. : "echo 'Hello ", "Colin O'Reilly" and "'" The second part was from the feather variable "name", and contains a single quote. From the first part, we see a quote before "Hello", so subsequent non-literal parts must be escaped. So when we get to the 2nd part, we escape the quote to form :

Colin O'\''Reilly

The 3rd part is a literal, so we don't attempt to escape it, and instead count the number of quotes, and we find the end quote, so if there were more parts, these wouldn't be escaped.