Skip to content

Instantly share code, notes, and snippets.

@miebach
Last active January 1, 2016 01:49
Show Gist options
  • Save miebach/8074909 to your computer and use it in GitHub Desktop.
Save miebach/8074909 to your computer and use it in GitHub Desktop.
Byobu's hostname script modified to show only the short hostname. Use the install script below and activate using F9 -> toggle -> hostname
#!/bin/sh -e
#
# hostname: report a host's name
#
# Copyright (C) 2008-2011 Canonical Ltd.
# Copyright (C) 2011 Dustin Kirkland
#
# Authors: Dustin Kirkland <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__hostname_detail() {
hostname -f
}
__hostname() {
local h=
h=$(hostname -s 2>/dev/null || hostname)
[ -n "$h" ] || return
color bold2; printf "%s" "$h"; color --
}
# vi: syntax=sh ts=4 noexpandtab
sudo curl -o /usr/lib/byobu/hostname https://gist.github.com/miebach/8074909/raw/df21f06a9c09975e7c635764afcce305c71b07fc/hostname
sudo chmod a+x /usr/lib/byobu/hostname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment