From 15b24ab9d782a8e5683f305ec8b1c31849a64246 Mon Sep 17 00:00:00 2001 From: Elizabeth Date: Mon, 19 May 2025 23:03:02 -0700 Subject: initial commit --- home/scripts/system_name.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 home/scripts/system_name.sh (limited to 'home/scripts/system_name.sh') diff --git a/home/scripts/system_name.sh b/home/scripts/system_name.sh new file mode 100755 index 0000000..92b714a --- /dev/null +++ b/home/scripts/system_name.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +platform="$(platform.sh)" + +MACHINE="$HOST" +if [ "$platform" = "osx" ]; then + MACHINE="$(scutil --get ComputerName)" +elif [ "$platform" = "linux" ]; then + MACHINE="$(cat /proc/sys/kernel/hostname)" +fi + +echo $MACHINE | awk -F\. '{print $1}' \ + | tr '[:upper:]' '[:lower:]' \ + | tr ' ' '-' -- cgit v1.2.3-70-g09d2