# Shellwords.escape works incorrect under windows

**URL:** <https://www.ruby-forum.com/t/shellwords-escape-works-incorrect-under-windows/227160>\
**Category:** Ruby\
**Created:** [March 6, 2013, 4:38am UTC](https://www.ruby-forum.com/t/shellwords-escape-works-incorrect-under-windows/227160 "2013-03-06T04:38:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leonid-shevtsov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a183cd/32.png) [@leonid-shevtsov](https://www.ruby-forum.com/u/leonid-shevtsov)\
**Post date:** [March 6, 2013, 4:38am UTC](https://www.ruby-forum.com/t/shellwords-escape-works-incorrect-under-windows/227160/1 "2013-03-06T04:38:00Z")

</div>

I didn’t found where to post bug reports, so I decide to start new  
topic.

Shellwords.escape works incorrect under windows (tested for Windows 7  
x64), here is example:

Actual result:

irb(main):001:0\> require ‘shellwords’  
=\> true

irb(main):002:0\> `echo #{Shellwords.escape( '123>' )} test` # should  
echo “123\> test”, but echo nothing  
=\> “”

irb(main):003:0\> File.read( ‘test’ ) # but writes file “test”  
=\> “123\\n”

Expected result:

irb(main):001:0\> `echo 132^> test` # the correct escape sequence, echoed  
“123\> test”  
=\> “132\> test\n”

I didn’t found github or any repository for Shellwords, so I can’t  
create issue in right place. Is there any place where issues for  
stdlibs/corelibs are located?

---

<div class="post-metadata">

**Author:** ![leonid-shevtsov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a183cd/32.png) [@leonid-shevtsov](https://www.ruby-forum.com/u/leonid-shevtsov)\
**Post date:** [March 6, 2013, 7:49am UTC](https://www.ruby-forum.com/t/shellwords-escape-works-incorrect-under-windows/227160/2 "2013-03-06T07:49:29Z")

</div>

On 03/05/2013 07:38 PM, Leonid Shagabutdinov wrote:

> =\> true
> 
> irb(main):001:0\> `echo 132^> test` # the correct escape sequence, echoed  
> “123\> test”  
> =\> “132\> test\n”
> 
> I didn’t found github or any repository for Shellwords, so I can’t  
> create issue in right place. Is there any place where issues for  
> stdlibs/corelibs are located?

You can report issues here: [https://bugs.ruby-lang.org/](https://bugs.ruby-lang.org/)

The code for shellwords is here:  
[https://github.com/ruby/ruby/blob/trunk/lib/shellwords.rb](https://github.com/ruby/ruby/blob/trunk/lib/shellwords.rb)

Looks like it is explicitly for Bourne shells, with no consideration for  
Windows. On the upside, it is just Ruby so should be easy to add what  
you need.

-Justin
