Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6218971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:41:58+00:00 2026-05-24T07:41:58+00:00

When using startup scripts on Linux / Ubuntu, can I access environment variables such

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:41:58+00:00Added an answer on May 24, 2026 at 7:41 am

    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:

    /usr/bin/env -i /bin/sh -c set
    

    On my system (fedora 15) this end up running bash and outputing:

    BASH=/bin/sh
    BASHOPTS=cmdhist:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
    BASH_ALIASES=()
    BASH_ARGC=()
    BASH_ARGV=()
    BASH_CMDS=()
    BASH_EXECUTION_STRING=set
    BASH_LINENO=()
    BASH_SOURCE=()
    BASH_VERSINFO=([0]="4" [1]="2" [2]="10" [3]="1" [4]="release" [5]="i386-redhat-linux-gnu")
    BASH_VERSION='4.2.10(1)-release'
    DIRSTACK=()
    EUID=xxx
    GROUPS=()
    HOSTNAME=xxx
    HOSTTYPE=i386
    IFS=''
    MACHTYPE=i386-redhat-linux-gnu
    OPTERR=1
    OPTIND=1
    OSTYPE=linux-gnu
    PATH=/usr/local/bin:/bin:/usr/bin
    POSIXLY_CORRECT=y
    PPID=xxx
    PS4='+ '
    PWD=/home/xxx
    SHELL=/bin/zsh
    SHELLOPTS=braceexpand:hashall:interactive-comments:posix
    SHLVL=1
    TERM=dumb
    UID=xxx
    _=/bin/sh
    

    In Ubuntu /bin/sh is a symlink to dash, the output will be more like:

    IFS=''
    LINENO='1'
    OPTIND='1'
    PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
    PPID='xxx'
    PS1='$ '
    PS2='> '
    PS4='+ '
    PWD='/home/xxx'
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know you can set max heap size at startup using -Xmx but is
I'm running Ubuntu on EC2 (using the alestic community AMI) and on startup my
I'm using Ubuntu 9.04 x64 and, I have a file startup.rb in which I
What is google apps and why are so many startup companies using it?
Using the Pre Release Xcode 3.2.3 I get this as a Startup Project (source:
I have been using Netbeans 6.5 recently - it complains (on startup, and if
I'm using hibernate 3 and want to stop it from dumping all the startup
By default when using a webapp server in Eclipse Web Tools, the server startup
So I installed Ruby On Rails using the Windows Installer. Now the startup guides
I'm in a little bitty startup company. Right now we are using JEDI VCS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.