Created
June 5, 2025 05:48
-
-
Save kareiva/c2797213e8c2b7cefae08ff3b71e93ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
myenv="" | |
if [ ! -z $container ]; then | |
myenv="${myenv}In a $container container. " | |
else | |
myenv="${myenv}On a $(uname) server. " | |
fi | |
if mount | grep 'overlay on / ' >& /dev/null; then | |
myenv="${myenv}Inside an overlay filesystem. " | |
fi | |
if [ -f /var/run/secrets/kubernetes.io ]; then | |
myenv="${myenv}Inside a Kubernetes cluster. " | |
fi | |
if systemd-detect-virt >& /dev/null; then | |
myenv="${myenv}Running in a VM. " | |
fi | |
if [ ! -z $SSH_CONNECTION ]; then | |
myenv="${myenv}In someone else's computer. " | |
fi | |
echo $myenv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment