Windows has a powershell command called
setx which Creates or modifies environment variables in the user or system environment.
Does Ubuntu has a similar command, i.e. not by using
vi, just one line to add or update an environment variable system wide.
One line to add/update
grep env_name /etc/environment && sed -i.bak 's/env_name=.*/env_name="env_value"/' /etc/environment || echo 'env_name="env_value"' >> /etc/environment