diff options
author | Elizabeth <me@liz.coffee> | 2025-05-19 23:03:02 -0700 |
---|---|---|
committer | Elizabeth <me@liz.coffee> | 2025-05-19 23:03:02 -0700 |
commit | 15b24ab9d782a8e5683f305ec8b1c31849a64246 (patch) | |
tree | bdb7c85f0d1f81e493c43360125ca61d6d26145c /home/scripts/system_name.sh | |
download | dotfiles-15b24ab9d782a8e5683f305ec8b1c31849a64246.tar.gz dotfiles-15b24ab9d782a8e5683f305ec8b1c31849a64246.zip |
initial commit
Diffstat (limited to 'home/scripts/system_name.sh')
-rwxr-xr-x | home/scripts/system_name.sh | 14 |
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 ' ' '-' |