I am attempting to write a script that automates the installation of ports/packages on new FreeBSD installs. To do this, the user who executes the script must be root.
The system is "supposed" to be virgin meaning bash and sudo may or may not be installed; so I am trying to account for it. To do this, I am checking if the user ID equals 0.
The problem is, between bash and sh, the environment variables are different:
- bash -> $EUID (all caps)
- sh -> $euid (all lower)
Is there a different way other than the environment variable to check for root user or should I just adjust the checking of the user based on environment?