#!/bin/bash #================================================= # COMMON VARIABLES #================================================= nodejs_version=14 #================================================= # PERSONAL HELPERS #================================================= #================================================= # EXPERIMENTAL HELPERS #================================================= #================================================= # FUTURE OFFICIAL HELPERS #================================================= # Execute a command as another user # usage: ynh_exec_as USER COMMAND [ARG ...] ynh_exec_as() { local USER=$1 shift 1 if [[ $USER = $(whoami) ]]; then eval "$@" else sudo -u "$USER" "$@" fi }