@cindex bugs, reporting
Please report bugs to @samp{bug-gnu-utils@@prep.ai.mit.edu}. Remember
to include the version number, machine architecture, input files, and
-any other information needed to reproduce the bug. @xref{Bugs, , , gcc,
-GNU CC}.
+any other information needed to reproduce the bug: your input, what you
+expected, what you got, and why it is wrong. Diffs are welcome, but
+please include a description of the problem as well, since this is
+sometimes difficult to infer. @xref{Bugs, , , gcc, GNU CC}.
@cindex history
+@cindex MacKenzie, David
+@cindex Meyering, Jim
+@c Sorry, but the @value trick doesn't work with TeX in indexing
+@c commands, and I don't want to fix it right now. --karl.
+@cindex Pinard, Francois
+@cindex Berry, Karl
+@cindex Stallman, Richard
This manual is based on the Unix man pages in the distribution, which
were originally written by David MacKenzie and updated by Jim Meyering.
@c If the following space before `@value' is removed, makeinfo
Synopsis:
@example
-echo [ @var{option} ]@dots{} [ @var{string} ]@dots{}
+echo [@var{option}]@dots{} [@var{string}]@dots{}
@end example
@code{echo} writes each given @var{string} to standard output, with a
Synopsis:
@example
-printf @var{format} [ @var{argument} ]@dots{}
+printf @var{format} [@var{argument}]@dots{}
@end example
@code{printf} prints the @var{format} string, interpreting @samp{%}
@cindex socket check
True if @var{file} exists and is a socket.
-@item -t [ @var{fd} ]
+@item -t [@var{fd}]
@opindex -t
@cindex terminal check
True if @var{fd} is opened on a terminal. If @var{fd} is omitted, it
Synopsis:
@example
-tee [ @var{option} ]@dots{} [ @var{file} ]@dots{}
+tee [@var{option}]@dots{} [@var{file}]@dots{}
@end example
If a file being written to does not already exist, it is created. If a
Synopsis:
@example
-basename @var{name} [ @var{suffix} ]
+basename @var{name} [@var{suffix}]
@end example
The @code{basename} command removes any leading directory components
Synopsis:
@example
-pathchk [ @var{option} ]@dots{} @var{name}@dots{}
+pathchk [@var{option}]@dots{} @var{name}@dots{}
@end example
For each @var{name}, @code{pathchk} prints a message if any of
Synopses:
@example
-stty [ @var{setting} ]@dots{}
-stty [ @var{option} ]
+stty [@var{setting}]@dots{}
+stty [@var{option}]
@end example
The program accepts the following options. Also see @ref{Common options}.
Synopsis:
@example
-printenv [ @var{option} ] [ @var{variable} ]@dots{}
+printenv [@var{option}] [@var{variable}]@dots{}
@end example
If no @var{variable}s are specified, @code{printenv} prints the value of
Synopsis:
@example
-tty [ @var{option} ]@dots{}
+tty [@var{option}]@dots{}
@end example
The program accepts the following option. Also see @ref{Common options}.
Synopsis:
@example
-id [ @var{option} ]@dots{} [ @var{username} ]
+id [@var{option}]@dots{} [@var{username}]
@end example
By default, it prints the real user id, real group id, effective user id
Synopsis:
@example
-groups [ @var{username} ]@dots{}
+groups [@var{username}]@dots{}
@end example
The group lists are equivalent to the output of the command @samp{id -Gn}.
Synopsis:
@example
-users [ @var{file} ]
+users [@var{file}]
@end example
@flindex /etc/utmp
Synopsis:
@example
-@code{who} [ @var{option} ] [ @var{file} ] [ am i ]
+@code{who} [@var{option}] [@var{file}] [am i]
@end example
@cindex terminal lines, currently used
Synopses:
@example
-date [ @var{option} ]@dots{} [ +@var{format} ]
-date [ -u|--utc|--universal ] @c this avoids a newline in the output
+date [@var{option}]@dots{} [+@var{format}]
+date [-u|--utc|--universal] @c this avoids a newline in the output
[ @var{MMDDhhmm}[[@var{CC}]@var{YY}][.@var{ss}] ]
@end example
directives, which start with @samp{%}, characters in the format string
are printed unchanged. The directives are described below.
-@cindex numeric field padding
-@cindex padding of numeric fields
-@cindex fields, padding numeric
-By default, @code{date} pads numeric fields with zeroes.
-GNU @code{date} recognizes the following numeric modifiers
-between the @samp{%} and the directive. These are GNU extensions.
-
-@table @samp
-@item -
-(hyphen) do not pad the field
-@item _
-(underscore) pad the field with spaces
-@end table
-
@menu
* Time directives:: %[HIklMprsSTXZ]
* Date directives:: %[aAbBcdDhjmUwWxyY]
* Literal directives:: %[%nt]
+* Padding:: Pad with zeroes, spaces (%_), or nothing (%-).
* Setting the time:: Changing the system clock.
* Options for date:: Instead of the current time.
* Examples of date:: Examples.
@end table
+@node Padding
+@subsection Padding
+
+@cindex numeric field padding
+@cindex padding of numeric fields
+@cindex fields, padding numeric
+
+By default, @code{date} pads numeric fields with zeroes, so that, for
+example, numeric months are always output as two digits. GNU @code{date}
+recognizes the following numeric modifiers between the @samp{%} and the
+directive.
+
+@table @samp
+@item -
+(hyphen) do not pad the field; useful if the output is intended for
+human consumption.
+@item _
+(underscore) pad the field with spaces; useful if you need a fixed
+number of characters in the output, but zeroes are too distracting.
+@end table
+
+@noindent
+These are GNU extensions.
+
+Here is an example illustrating the differences:
+
+@example
+date +%d/%m -d "Feb 1"
+@result{} 01/02
+date +%-d/%-m -d "Feb 1"
+@result{} 1/2
+date +%_d/%_m -d "Feb 1"
+@result{} 1/ 2
+@end example
+
+
@node Setting the time
@subsection Setting the time
Synopsis:
@example
-uname [ @var{option} ]@dots{}
+uname [@var{option}]@dots{}
@end example
If multiple options or @code{-a} are given, the selected information is
Synopsis:
@example
-hostname [ @var{name} ]
+hostname [@var{name}]
@end example
The only options are @samp{--help} and @samp{--version}. @xref{Common
Synopses:
@example
-env [ @var{option} ]@dots{} [ @var{name}=@var{value} ]@dots{} @c
-[ @var{command} [ @var{args} ]@dots{} ]
+env [@var{option}]@dots{} [@var{name}=@var{value}]@dots{} @c
+[@var{command} [@var{args}]@dots{}]
env
@end example
Synopsis:
@example
-nice [ @var{option} ]@dots{} [ @var{command} [ @var{arg} ]@dots{} ]
+nice [@var{option}]@dots{} [@var{command} [@var{arg}]@dots{}]
@end example
@cindex conflicts with shell built-ins
Synopsis:
@example
-nohup @var{command} [ @var{arg} ]@dots{}
+nohup @var{command} [@var{arg}]@dots{}
@end example
@flindex nohup.out
Synopsis:
@example
-su [ @var{option} ]@dots{} [ @var{user} [ @var{arg} ]@dots{} ]
+su [@var{option}]@dots{} [@var{user} [@var{arg}]@dots{}]
@end example
@cindex passwd entry, and @code{su} shell
Synopsis:
@example
-sleep [ @var{number}[smhd] ]@dots{}
+sleep [@var{number}[smhd]]@dots{}
@end example
@cindex time units