When using startup scripts on Linux / Ubuntu, can I access environment variables such as HOME or are these specific to the user/configuration that is loaded afterwards?
When using startup scripts on Linux / Ubuntu, can I access environment variables such
Share
Yes and no. Some variables are specific to your instalation, others to the shell running the init scripts. A simple way to know the minimal set available is with:
On my system (fedora 15) this end up running bash and outputing:
In Ubuntu /bin/sh is a symlink to dash, the output will be more like:
As a general rule $HOME is not a good candidate, if you need the home directory of a particular user, use ~username instead like ~www-data, ~ftp, or ~root.