Skip to content

Instantly share code, notes, and snippets.

View jubalfh's full-sized avatar

Miroslaw Baran jubalfh

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jubalfh on github.
  • I am jubal (https://keybase.io/jubal) on keybase.
  • I have a public key whose fingerprint is EDFF 6C46 1AC1 4AB2 7CC8 02C2 5931 F443 5518 D7D3

To claim this, I am signing this object:

run_as() {
local uid newuid bash_argv
read -r newuid <<< "$1"
read -r bash_argv <<< "${BASH_ARGV[@]}"
uid="$(id -nu)"
if [[ "${uid}" == "root" ]]; then
exec su - "${newuid}" -s /bin/bash -c "$0 ${bash_argv}"
fi
}