summaryrefslogtreecommitdiffstats
path: root/linhes/linhes-system/lh_home_check.sh
diff options
context:
space:
mode:
Diffstat (limited to 'linhes/linhes-system/lh_home_check.sh')
-rwxr-xr-xlinhes/linhes-system/lh_home_check.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/linhes/linhes-system/lh_home_check.sh b/linhes/linhes-system/lh_home_check.sh
new file mode 100755
index 0000000..de4e089
--- /dev/null
+++ b/linhes/linhes-system/lh_home_check.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+#Detect the name of the display in use
+display=":$(ls /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)"
+
+#Detect the user using such display
+user=$(who | grep '('$display')' | awk '{print $1}' | head -n 1)
+
+echo /home/$user