Adviser to Unix Ambiance Variables

 09 February 17:12   

    An ambiance capricious is a ambience commonly affiliated or declared if a carapace is started. You can use shells to set variables; the syntax varies but Absolute shells use:

     $ VARNAME=new value

     $ consign VARNAME

     or

     $ consign VARNAME=new value

    Each program started from that carapace will accept VARNAME set to new value. The names of ambiance variables are case-sensitive; by assemblage they are uppercase.

    A carapace capricious is like an ambiance variable, except that it is not exported to new program s started from that shell. (You could consign it, but commonly you just address a carapace initialisation Software to set it in anniversary shell.)

    


    The editor program alleged by sudoedit, vipw, and additional such programs if you acquaint them to adapt a file.

    Examples:

     EDITOR=vi

     EDITOR=emacs

    The home agenda of the user. Alotof programs use this carapace capricious to acquisition your home, appropriately you can set this capricious to override the ambience in /etc/passwd for your home directory. This way, you can alpha programs that put dotfiles or additional files in a altered agenda than your accepted home directory.

    In alotof shells , ~ refers to your home directory. In Absolute shell, ~tux consistently refers to the home agenda of user tux as defined in /etc/passwd, while ~ (without a username afterwards it) consistently refers to the amount of HOME, even if it differs from your home agenda in /etc/passwd.

    The name of the user. This is an simple way for a user to get own username. However, programs haveto not assurance this capricious because it can be set to an approximate value.

    Both LOGNAME and USER should be set to the username.

    Examples:

     LOGNAME=tux

     LOGNAME=puffy

    The area of admission bounded email. If mail or addition bounded email clairvoyant inherits this ambiance variable, it uses this capricious to acquisition the inbox.

    Some users do not accept email at their bounded Unix box, but instead use the Internet to admission their mail server, in which case the MAIL ambiance capricious is irrelevant.

    Many users do not accept MAIL set, in which case the email clairvoyant uses the absence setting. The absence amount for user tux would be /var/mail/tux, which is area some systems bear mail.

    :This is a carapace variable, not commonly exported as an ambiance variable.

    The abundance for which back-bite checks and alerts you for new bounded email.

    The pager alleged by man and additional such programs if you acquaint them to appearance a file.

    Examples:

     PAGER=less

     PAGER=more

    A amplitude or colon afar account of directories in which the carapace searches for executables if a command is run after an complete path. For archetype ls doesnt accept an complete path, but /bin/ls does).

    Some systems set Aisle using the arrangement carapace initialistation files, such as /etc/profile for Absolute shells . Some systems set Aisle afore this as allotment of the login procedure, for archetype in /etc/login.conf for OpenBSD systems. For example, a Linux box could set the Aisle at login, then add /usr/X11R6/bin to the aisle using /etc/profile, then add /home/ambler/bin to the aisle using ~/.bash_profile.

    The arrangement cossack scripts aswell set PATH. On some Linux boxes, the first command to set the aisle would assume to be in /etc/rc.d/rc.sysinit, which is one of the carapace scripts invoked by the init action (inittab).

    Examples:

     PATH=/bin:/sbin:/usr/bin:/usr/sbin:/home/puffy/bin

    If this Aisle is set and you blazon the carapace command

     $ uname -r

    then the carapace searches for the uname executable program. First it searches in /bin, then /sbin, then /usr/bin. If /bin/uname is an executable (which it should be), then the carapace stops analytic and runs it. If /home/puffy/bin/uname aswell is executable, it is not run, because the seek never accomplished that directory.

    :This is a carapace variable, not commonly exported as an ambiance variable.

    The back-bite and accessible area ksh shells use this as the alert string.

    Things that can be put in the alert cord cover h (hostname), u (username), w (absolute pathname of alive directory), W (name of alive agenda w/o path), d (date), (time).

    On some Red Hat boxes, the primary alert cord is set in the /etc/bashrc file. The alert is aswell set in /etc/profile, but the ambience in bashrc seems to yield precedence. A ~/.bashrc book runs /etc/bashrc, which sets the prompt. Because every instance of back-bite runs ~/.bashrc, the alert aswell appears in X sessions started from a affectation administrator such as xdm.

    On some Slackware boxes, the command band alert is set in /etc/profile. The xterm and rxvt prompts are different. The alert is not set for X sessions, but it would be if you address a ~/.bashrc to do that. Prompts are carapace variables set from carapace initialisation scripts. They are not xterm settings set by X assets such as /usr/X11R6/lib/X11/app-defaults/XTerm.

    :This is a carapace variable, not commonly exported as an ambiance variable.

    The back-bite and accessible area ksh shells use this as a accessory alert string.

    This capricious should accept the aforementioned ambience and purpose as .

    

 


Tags: absolute, program, programs, email, systems, example, started, boxes, value, examples, profile, directory, environment, scripts, editor, searches, refers, command, setting, string

 shell, variable, directory, environment, prompt, bashrc, shells, programs, variables, profile, normally, email, setting, value, username, uname, local, command, systems, examples, started, varname, string, exported, scripts, login, executable, xterm, boxes, refers, editor, program, export, bourne, passwd, logname, absolute, searches, pager, example, , environment variable, home directory, shell variable, etc profile, prompt string, variable the, path using, normally exported, boxes the, local email, shells use, started from, etc passwd, environment variables, variable not, started from that, unix environment variables,

Share Adviser to Unix Ambiance Variables:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

Permalink
Article In : Computers & Technology  -  Unix