From 985714befd12a695f0b26260d4861ff72888e5b2 Mon Sep 17 00:00:00 2001 From: lbonanomi Date: Wed, 26 Dec 2018 20:02:17 -0500 Subject: [PATCH 1/2] 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) From b8c363ec7e7d2271f76874b644506dd3d5f14f6c Mon Sep 17 00:00:00 2001 From: lbonanomi <5369016+lbonanomi@users.noreply.github.com> Date: Wed, 26 Dec 2018 20:15:05 -0500 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a6178c..78036d1 100644 --- a/README.md +++ b/README.md @@ -1229,7 +1229,7 @@ who -b ###### Detect a user sudo-su'd into the current shell -``` +```bash [[ $(who -m | awk '{ print $1 }') == $(whoami) ]] || echo "You are su-ed to $(whoami)" ```