summaryrefslogtreecommitdiff
path: root/home/scripts/system_name.sh
diff options
context:
space:
mode:
authorElizabeth <me@liz.coffee>2025-05-19 23:03:02 -0700
committerElizabeth <me@liz.coffee>2025-05-19 23:03:02 -0700
commit15b24ab9d782a8e5683f305ec8b1c31849a64246 (patch)
treebdb7c85f0d1f81e493c43360125ca61d6d26145c /home/scripts/system_name.sh
downloaddotfiles-15b24ab9d782a8e5683f305ec8b1c31849a64246.tar.gz
dotfiles-15b24ab9d782a8e5683f305ec8b1c31849a64246.zip
initial commit
Diffstat (limited to 'home/scripts/system_name.sh')
-rwxr-xr-xhome/scripts/system_name.sh14
1 files changed, 14 insertions, 0 deletions
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 ' ' '-'