Rather, the list has one entry per line. The list should be space delimited; drush help pm-list shows for --pipe:
"Returns a space delimited list of the names of the resulting extensions."

A space-delimited list is desired for directly inputting the list to other drush commands (e.g. pm-enable).

Comments

threexk’s picture

(I assume "space" isn't interpreted liberally to mean any whitespace.)

greg.1.anderson’s picture

Category: bug » support
Status: Active » Fixed

The shell will automatically convert whitespace (e.g. line breaks) into spaces as necessary; for example, try echo $(drush pm-list --pipe) and you will see that the --pipe output is already well-suited for use with pm-enable & c.

Outputting the list newline-delimited instead of space-delimited makes it easier to further process the output with grep, etc.

greg.1.anderson’s picture

Oh, and yes, "space" was interpreted liberally to mean any whitespace. I changed the documentation to say "whitespace" instead of "space" for the avoidance of doubt. Committed to master and 7.x-4.x.

raelianer’s picture

Status: Fixed » Active

On Windows it's not converted to space. Can't you just change this?

greg.1.anderson’s picture

Version: 7.x-4.5 »
Issue tags: +Windows

Changing this is out of the question for drush-4.x, as it could break scripts that depend on the output being on separate lines.

We could change this for drush-5.x; I am of mixed minds about this. Using a reasonable shell, such as bash, msysgit (which has bash), cygwin, etc., it is more convenient to convert line-separated output to space-separated output (per #2) than to go the other way around. On the other hand, I don't want to simply say "don't use Powershell / DOS".

I've tagged this issue as "Windows"; perhaps @kulov or @beltofte could chime in on the utility of this change for Windows, or other alternatives.

Is anyone from the Linux/bash camp opposed to making this change?

beltofte’s picture

In PowerShell is "echo $(drush pm-list --pipe)" working fine, it's returning the project list separated by newline though. Using write-host instead e.g. "write-host $(drush pm-list --pipe)" returns the list space separated in PowerShell :-) See more details about write-host on http://ss64.com/ps/write-host.html.

write-host is not available in CMD, and "echo $(drush pm-list --pipe)" is not executing the command in CMD, but just outputting "drush pm-list --pipe".

jonhattan’s picture

Status: Active » Closed (duplicate)