问题描述
在 Rails 2.3.12 中通过 PuTTY 使用脚本/控制台.当我按向上"箭头访问我写的最后一个命令时,它不会调出命令,而是将奇怪的字符串^[[A"打印到终端.与其他箭头相同……向后箭头打印^[[D",向前箭头打印^[[C"
Using script/console in rails 2.3.12 over PuTTY. When I press the "up" arrow to access the last command I wrote, instead of bringing up the command it just prints the weird string "^[[A" to the terminal. Same with other arrows...back arrow prints "^[[D" and forward arrow prints "^[[C"
希望有人认出这些奇怪的代码,并可能告诉我如何让箭头正常工作.这是 PuTTY 设置问题吗?
Hoping somebody recognizes these weird codes, and can possibly tell me how to get the arrows working properly. Is this a PuTTY settings issue?
推荐答案
向上箭头功能由 阅读线.通常,在构建 ruby 时,./configure 会自动检测 readline 库并为它们构建 ruby 映射.有时这不起作用,您必须在构建 ruby 时安装新库或自定义配置 --with-readline-dir.irb 和 rails-console 仅使用 ruby stdlib 的 readline 功能,所以您的问题很可能是您的 ruby 构建没有检测和绑定 readline.
The up-arrow functionality is supplied by readline. Typically, when ruby is built, ./configure auto-detects the readline libraries and builds ruby mappings to them. Sometimes this doesn't work and you have to install new libraries or custom configure --with-readline-dir when building ruby. irb and rails-console just use the readline capability of the ruby stdlib, soyour problem is likely that your ruby build didn't detect and bind readline.
我建议您调查与使用 readline 构建 ruby 相关的其他 SO 问题看看其中一个是否为您提供了有关您的 ruby 版本和操作系统的指导.
I suggest you survey the other SO questions relevant to building ruby with readline to see if one of them gives you guidance for your version of ruby and your OS.
这篇关于通过 PuTTY 在 Rails 控制台中的命令历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!