1ALIAS(P) POSIX Programmer's Manual ALIAS(P)
2
3
4
6 alias - define or display aliases
7
9 alias [alias-name[=string] ...]
10
12 The alias utility shall create or redefine alias definitions or write
13 the values of existing alias definitions to standard output. An alias
14 definition provides a string value that shall replace a command name
15 when it is encountered; see Alias Substitution .
16
17 An alias definition shall affect the current shell execution environ‐
18 ment and the execution environments of the subshells of the current
19 shell. When used as specified by this volume of IEEE Std 1003.1-2001,
20 the alias definition shall not affect the parent process of the current
21 shell nor any utility environment invoked by the shell; see Shell Exe‐
22 cution Environment .
23
25 None.
26
28 The following operands shall be supported:
29
30 alias-name
31 Write the alias definition to standard output.
32
33 alias-name=string
34
35 Assign the value of string to the alias alias-name.
36
37
38 If no operands are given, all alias definitions shall be written to
39 standard output.
40
42 Not used.
43
45 None.
46
48 The following environment variables shall affect the execution of
49 alias:
50
51 LANG Provide a default value for the internationalization variables
52 that are unset or null. (See the Base Definitions volume of
53 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
54 ables for the precedence of internationalization variables used
55 to determine the values of locale categories.)
56
57 LC_ALL If set to a non-empty string value, override the values of all
58 the other internationalization variables.
59
60 LC_CTYPE
61 Determine the locale for the interpretation of sequences of
62 bytes of text data as characters (for example, single-byte as
63 opposed to multi-byte characters in arguments).
64
65 LC_MESSAGES
66 Determine the locale that should be used to affect the format
67 and contents of diagnostic messages written to standard error.
68
69 NLSPATH
70 Determine the location of message catalogs for the processing of
71 LC_MESSAGES .
72
73
75 Default.
76
78 The format for displaying aliases (when no operands or only name oper‐
79 ands are specified) shall be:
80
81
82 "%s=%s\n", name, value
83
84 The value string shall be written with appropriate quoting so that it
85 is suitable for reinput to the shell. See the description of shell
86 quoting in Quoting .
87
89 The standard error shall be used only for diagnostic messages.
90
92 None.
93
95 None.
96
98 The following exit values shall be returned:
99
100 0 Successful completion.
101
102 >0 One of the name operands specified did not have an alias defini‐
103 tion, or an error occurred.
104
105
107 Default.
108
109 The following sections are informative.
110
112 None.
113
115 1. Change ls to give a columnated, more annotated output:
116
117
118 alias ls="ls -CF"
119
120 2. Create a simple "redo" command to repeat previous entries in the
121 command history file:
122
123
124 alias r='fc -s'
125
126 3. Use 1K units for du:
127
128
129 alias du=du\ -k
130
131 4. Set up nohup so that it can deal with an argument that is itself an
132 alias name:
133
134
135 alias nohup="nohup "
136
138 The alias description is based on historical KornShell implementations.
139 Known differences exist between that and the C shell. The KornShell
140 version was adopted to be consistent with all the other KornShell fea‐
141 tures in this volume of IEEE Std 1003.1-2001, such as command line
142 editing.
143
144 Since alias affects the current shell execution environment, it is gen‐
145 erally provided as a shell regular built-in.
146
147 Historical versions of the KornShell have allowed aliases to be
148 exported to scripts that are invoked by the same shell. This is trig‐
149 gered by the alias -x flag; it is allowed by this volume of
150 IEEE Std 1003.1-2001 only when an explicit extension such as -x is
151 used. The standard developers considered that aliases were of use pri‐
152 marily to interactive users and that they should normally not affect
153 shell scripts called by those users; functions are available to such
154 scripts.
155
156 Historical versions of the KornShell had not written aliases in a
157 quoted manner suitable for reentry to the shell, but this volume of
158 IEEE Std 1003.1-2001 has made this a requirement for all similar out‐
159 put. Therefore, consistency with this volume of IEEE Std 1003.1-2001
160 was chosen over this detail of historical practice.
161
163 None.
164
166 Function Definition Command
167
169 Portions of this text are reprinted and reproduced in electronic form
170 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
171 -- Portable Operating System Interface (POSIX), The Open Group Base
172 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
173 Electrical and Electronics Engineers, Inc and The Open Group. In the
174 event of any discrepancy between this version and the original IEEE and
175 The Open Group Standard, the original IEEE and The Open Group Standard
176 is the referee document. The original Standard can be obtained online
177 at http://www.opengroup.org/unix/online.html .
178
179
180
181IEEE/The Open Group 2003 ALIAS(P)