screen/byobu presence inferred by an environment variable

Bug #1179304 reported by Jan Dahl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Server Guide
New
Undecided
Unassigned

Bug Description

Hey there,

I've recently discovered that $STY is set when running a terminal in byobu (or screen). I think i would be suitable to add to the documentation (https://help.ubuntu.com/10.04/serverguide/byobu.html).

Proposed addition:

You can check for the presence of byobu in your scripts by checking for the $STY environment variable, e.g.

<pre>if [ -n $STY ]; then...</pre>

Tags: byobu screen
affects: ubuntu-docs (Ubuntu) → serverguide
Revision history for this message
Jan Dahl (ubuntu-com-ninja) wrote :

Here's an example script that I use (from my own repo: https://github.com/jandahl/updateScreenWindowTitles)

#!/usr/bin/env bash

# If running in screen, set trap to fall back to current hostname
# If you want it to blank, replace ${HOSTNAME} with a space :-)
if [ -n $STY ] ; then
  trap 'echo -n -e "\033k${HOSTNAME}\033\\"' 0 1 2 15
  echo -n -e "\033k$1\033\\"
fi
/usr/bin/env ssh $*

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.