!! | 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