Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Always be screened

This tip originally by Cygnus at http://www.parsed.org
You can use this in your shell dotfile (e.g. ’/.bash_profile’, ’/.zshrc’) to create a ‘screen’ session when you log in or reattach to an existing screen:

   1  
   2  
   3  if [[ $TERM != 'screen' ]] ; then
   4      if [[ `screen -list | grep -v "No" | awk '$2 { print }' | wc -l` == 0 ]] ; then
   5          screen
   6      else
   7          screen -dr
   8      fi
   9  fi
  10  

You need to create an account or log in to post comments to this site.


Click here to browse all 5556 code snippets