1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/phpmyadmin_ynh.git synced 2024-09-03 19:56:46 +02:00
phpmyadmin_ynh/scripts/_common.sh

19 lines
342 B
Bash
Raw Normal View History

#!/bin/bash
2019-02-17 15:42:09 +01:00
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
2019-02-17 15:42:09 +01:00
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
exec_as() {
local USER=$1
shift 1
2019-02-17 15:42:09 +01:00
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}