Skip to content

Instantly share code, notes, and snippets.

@akoskovacs
Created August 15, 2013 19:44
Show Gist options
  • Save akoskovacs/6244116 to your computer and use it in GitHub Desktop.
Save akoskovacs/6244116 to your computer and use it in GitHub Desktop.
Attach to the first GNU screen
#!/usr/bin/env ruby
screens = `screen -ls`
screens.lines do |l|
if l =~ /\s+(\d+)\./
puts "Attaching to screen #{$1}..."
`screen -x #{$1}`
exit 1
end
end
puts "No screens found"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment