2011-11-29 23 views
22

पर पेड़ कमांड pry नामक रूबी मणि पर screen cast का पालन कर रहा हूं। 8:10 बजे, .tree कमांड का उपयोग किया जाता है, जो मुझे लगता है कि यूनिक्स कमांड है।ओएसएक्स बैश

यह अपने सिस्टम पर काम किया जाना प्रतीत नहीं होता है:

[24] pry(main)> .tree 
\Error: there was a problem executing system command: tree 

और मैं here के लिए इस मुद्दे का पता लगाया है, जिसमें संदर्भ एक शेल कमांड जिज्ञासा: के संदर्भ से

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 

बैश मैंने कमांड के साथ कमांड पेड़ का उपयोग करने की कोशिश की:

projects/sms(apps2)$ tree 
-bash: tree: command not found 
~/projects/sms(apps2)$ .tree 
-bash: .tree: command not found 

यह अविश्वसनीय लग रहा है शायद उपयोगी, मैं यह आदेश कैसे प्राप्त कर सकता हूं?

उत्तर

47

homebrew का उपयोग करना:

brew install tree

macports का उपयोग करना:

sudo port install tree

the source का उपयोग करना:

Follow these directions. (चेतावनी; आपको झंडे/आदि का उपयोग करना चाहिए। यह समझ में आता है।)

< रेंट> सभी सिस्टम tree के साथ आना चाहिए; मैंने इसे बहुत इस्तेमाल किया है। और हम निर्देशिका संरचनाओं को टेक्स्ट के रूप में पोस्ट कर सकते हैं, चित्रों पर नहीं। </rant>