Shellwords.shellescape实现对Ruby 1.8 [英] Shellwords.shellescape implementation for Ruby 1.8

查看:260
本文介绍了Shellwords.shellescape实现对Ruby 1.8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然1.8.7构建我好像有 Shellwords :: shellescape 的反向移植版本,我知道的方法是一个1.9的功能,绝对是不支持在早期版本的1.8。有谁知道在哪里可以找到,无论是创业板的形式或只是作为一个片断,一个强大的独立实施的Bourne shell命令逃逸的Ruby?

While the build of 1.8.7 I have seems to have a backported version of Shellwords::shellescape, I know that method is a 1.9 feature and definitely isn't supported in earlier versions of 1.8. Does anyone know where I can find, either in Gem form or just as a snippet, a robust standalone implementation of Bourne-shell command escaping for Ruby?

推荐答案

我伤口与逃生的宝石,这具有使用引号默认的附加功能,只有反斜杠逃逸时必要的。

I wound up going with the Escape gem, which has the additional feature of using quotes by default, and only backslash-escaping when necessary.

这篇关于Shellwords.shellescape实现对Ruby 1.8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆