Friday, 13 April 2018

macos - Copy the output of the last command in Terminal.app

!! | pbcopy would also run the commands again and couldn't be used with interactive commands.


This relies on the prompt always being $ :


tell application "Terminal" to tell window 1 to history
do shell script "/bin/echo " & quoted form of result & ¬
" | ruby -e 'puts $<.read.split(/^\\$ .*?$/)[-2][1..-1]'"
set the clipboard to result

Does anyone know any better options?

No comments:

Post a Comment

Where does Skype save my contact&#39;s avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...