Sunday, April 4, 2010

shell_here: Spawning a New Terminal Window in OSX

My lack of desire to learn bash scripting has resulted in today's script.

This script will take your current terminal window and spawn a new one with your entire environment copied. paste_env will also, as a side effect, leave a file called /pasted_env.

env | pbcopy 
osascript <<END 
tell app "Terminal" to do script "$(paste_env)" 

#!/usr/bin/env ruby
`pbpaste`.each { |var| 
puts var }
puts 'clear'

This opens up a previously locked door for Ruby scripting: affecting the current shell.

I ended up bothering people here and here and here to do this.

No comments: