> On Aug 2, 2015, at 4:50 PM, Gabriel Carrillo <erik.g....@gmail.com> wrote:
>
> Hi,
>
> I installed virtualenvwrapper on my Solaris 11 instance via pip, and noticed that running workon with no arguments fails to list my existing virtual envs. The source of the problem in my case is:
>
> 558 function virtualenvwrapper_show_workon_options {
> <...snipped...>
> 577 (virtualenvwrapper_cd "$WORKON_HOME" && echo */$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate) 2>/dev/null \
> 578 | command \tr "\n" " " \
> 579 | command \sed "s|/$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate |/|g" \
> 580 | command \tr "/" "\n" \
> 581 | command \sed "/^\s*$/d" \
> 582 | (unset GREP_OPTIONS; command \egrep -v '^\*$') 2>/dev/null
> 583 }
>
> On Solaris 11, GNU sed is not the default, and the three commands highlighted in red produce an empty result with the default sed. I'm not sure why this is, but I can reproduce this and simulate it with:
>
> $ echo "bar/bin/activate baz/bin/activate foo/bin/activate" | tr "\n" " " | sed 's!/bin/activate !/!g’
>
> For some reason, the above command produces an empty result, while GNU sed works as expected:
What is the output of that command without the sed part, with just the tr?
egc@fallover:~$ echo "bar/bin/activate baz/bin/activate foo/bin/activate" | tr "\n" " "
bar/bin/activate baz/bin/activate foo/bin/activate egc@fallover:~$
Does the sed command word if you pass a single value to it:
echo “bar/bin/activate” | sed 's!/bin/activate !/!g’
egc@fallover:~$ echo "bar/bin/activate " | sed 's!/bin/activate !/!g'
bar/
>
> $ echo "bar/bin/activate baz/bin/activate foo/bin/activate" | tr "\n" " " | /usr/gnu/bin/sed 's!/bin/activate !/!g'
> bar/baz/foo/
>
> A simple workaround for this is: export PATH="/usr/gnu/bin:$PATH"... however, I am curious about why the default sed invocation doesn't work. The tr(1) call preceding it seems to break the pipeline somehow, but I haven't figured it out. Any ideas?
What makes you think it is the tr call? You might be right, but if it is fixed by replacing the sed with a different version, it seems like the problem is with sed not tr.