December 09, 2004

Some useful variables in BASH

EUID
Expands to the effective user ID of the current user, initialized
at shell startup. This variable is readonly.

FUNCNAME
The name of any currently-executing shell function. This variable
exists only when a shell function is executing. Assignments
to FUNCNAME have no effect and return an error status. If
FUNCNAME is unset, it loses its special properties, even if it
is subsequently reset.

GROUPS
An array variable containing the list of groups of which the
current user is a member. Assignments to GROUPS have no effect
and return an error status. If GROUPS is unset, it loses its
special properties, even if it is subsequently reset.

HOSTNAME
Automatically set to the name of the current host.

LINENO
Each time this parameter is referenced, the shell substitutes a
decimal number representing the current sequential line number
(starting with 1) within a script or function. When not in a
script or function, the value substituted is not guaranteed to
be meaningful. If LINENO is unset, it loses its special proper-
ties, even if it is subsequently reset.

OSTYPE
Automatically set to a string that describes the operating system on which bash is executing. The
default is system-dependent.

PPID
The process ID of the shell's parent. This variable is read only.

RANDOM
Each time this parameter is referenced, a random integer between 0 and 32767 is generated. The
sequence of random numbers may be initialized by assigning a value to RANDOM. If RANDOM is
unset, it loses its special properties, even if it is subsequently reset.

UID
Expands to the user ID of the current user, initialized at shell
startup. This variable is readonly.

SECONDS
Each time this parameter is referenced, the number of seconds since shell invocation is returned.
If a value is assigned to SECONDS, the value returned upon subsequent references is the number
of seconds since the assignment plus the value assigned. If SECONDS is unset, it loses its special
properties, even if it is subsequently reset.

LINES
Used by the select builtin command to determine the column
length for printing selection lists. Automatically set upon
receipt of a SIGWINCH.

COLUMNS
Used by the select builtin command to determine the terminal
width when printing selection lists. Automatically set upon
receipt of a SIGWINCH.

ref. man bash

Posted by pank at December 9, 2004 12:15 AM
Comments
Post a comment













Remember personal info?