Skip to content

Instantly share code, notes, and snippets.

@petergi
Last active January 10, 2023 21:33
Show Gist options
  • Save petergi/3590d852e4c7baad9d878d6947810ab1 to your computer and use it in GitHub Desktop.
Save petergi/3590d852e4c7baad9d878d6947810ab1 to your computer and use it in GitHub Desktop.
#!/bin/bash
hostname=$(HOSTNAME | sed 's/.local//g' | sed 's/.gateway//g' )
# if hostname is >35 characters, truncates to make it fit on std. 80 window
if [ ${#HOSTNAME} -gt 35 ]
then
hostname=${HOSTNAME:0:35}
fi
echo $hostname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment