Some useful variables in BASH

| | Comments (0)

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

Leave a comment

March 2009

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

About this Entry

This page contains a single entry by Pank published on December 9, 2004 12:15 AM.

iptables DNAT port mapping test was the previous entry in this blog.

mt-bayesian is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.