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

32 lines
733 B
Bash
Raw Normal View History

2019-05-29 00:20:58 +02:00
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
2020-08-29 14:45:40 +02:00
nodejs_version=12
2019-05-29 00:20:58 +02:00
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}