From 985714befd12a695f0b26260d4861ff72888e5b2 Mon Sep 17 00:00:00 2001 From: lbonanomi Date: Wed, 26 Dec 2018 20:02:17 -0500 Subject: [PATCH] test if the current user is sudo-su'd into this session - signed-off-by: lbonanomi --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 807b60f..9a6178c 100644 --- a/README.md +++ b/README.md @@ -1227,6 +1227,12 @@ ___ who -b ``` +###### Detect a user sudo-su'd into the current shell + +``` +[[ $(who -m | awk '{ print $1 }') == $(whoami) ]] || echo "You are su-ed to $(whoami)" +``` + ___ ##### Tool: [screen](https://en.wikipedia.org/wiki/GNU_Screen)