【发布时间】:2011-11-29 00:09:22
【问题描述】:
我在名为pry 的红宝石宝石上关注screen cast。在 8:10,使用了 .tree 命令,我认为这是一个 Unix 命令。
它似乎无法在我的系统上运行:
[24] pry(main)> .tree
\Error: there was a problem executing system command: tree
我已将问题追溯到here,其中 pry 引用了一个 shell 命令:
Pry::CommandSet.new do
command(/\.(.*)/, "All text following a '.' is forwarded to the shell.", :listing => ".<shell command>") do |cmd|
if cmd =~ /^cd\s+(.+)/i
dest = $1
begin
Dir.chdir File.expand_path(dest)
rescue Errno::ENOENT
output.puts "No such directory: #{dest}"
end
else
if !system(cmd)
output.puts "Error: there was a problem executing system command: #{cmd}"
end
end
end
在 bash 的上下文中,我尝试使用命令树但没有成功:
projects/sms(apps2)$ tree
-bash: tree: command not found
~/projects/sms(apps2)$ .tree
-bash: .tree: command not found
这看起来非常有用,我怎样才能得到这个命令?
【问题讨论】: