Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何通过Ruby脚本在命令输出中保持颜色_Ruby_Unix_Command Line - Fatal编程技术网

如何通过Ruby脚本在命令输出中保持颜色

如何通过Ruby脚本在命令输出中保持颜色,ruby,unix,command-line,Ruby,Unix,Command Line,但是, 有没有办法获得彩色输出???试试ls--color=always对我来说效果很好。我在OSX上看不到颜色,我在linux上测试了它。对于OSX,你需要CLICOLOR\u FORCE=1 ls-G哇!成功了!你能把它贴出来作为答案吗?我会把它标记为正确答案。 ls -la # This gives a coloured output. puts %x{ ls -la } # The colours aren't preserved here.

但是,


有没有办法获得彩色输出???

试试
ls--color=always
对我来说效果很好。我在OSX上看不到颜色,我在linux上测试了它。对于OSX,你需要
CLICOLOR\u FORCE=1 ls-G
哇!成功了!你能把它贴出来作为答案吗?我会把它标记为正确答案。
ls -la # This gives a coloured output.
puts %x{ ls -la } # The colours aren't preserved here.