Hacker News new | past | comments | ask | show | jobs | submit login

The article uses, but does not describe pbcopy and pbpaste on os x. Feed data to pbcopy, and it goes to the clipboard:

  pwd | pbcopy # Copies the working directory to the clipboard
pbpaste outputs the clipboard contents:

  cd `pbpaste` # cd to the directory in the clipboard
(I use this to go to the same dir in a second terminal) (There's Linux equivalent called, xsel does the same.)



For Rubyists who are using Mac, these are very handy in IRB:

    # stick in .irbrc
    def copy(str)
      IO.popen('pbcopy', 'w') { |f| f << str.to_s }
    end

    def paste
      `pbpaste`
    end

    def ep
      eval(paste)
    end


I knew of pbcopy/pbpaste, but never thought of that. Great idea,

Python version (adjust to pbcopy/pbpaste if on OS X): http://gist.github.com/488852


If you're running on Windows, Vista/W7 has `clip` as an equivalent to pbcopy. One project I was working on, the sysadmin didn't give us any access to the server, so we had to instruct him to use git each time an update went through (daily). `git rev-parse HEAD | clip` was the fastest way to get the "revision your tree should be at after pulling" then and send it to him.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: