Parent Directory
|
Revision Log
defuzz patches
| 1 | diff -urNp coreutils-8.0-orig/configure.ac coreutils-8.0/configure.ac |
| 2 | --- coreutils-8.0-orig/configure.ac 2009-09-29 15:27:11.000000000 +0200 |
| 3 | +++ coreutils-8.0/configure.ac 2009-10-07 10:04:27.000000000 +0200 |
| 4 | @@ -115,6 +115,13 @@ if test "$gl_gcc_warnings" = yes; then |
| 5 | AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks]) |
| 6 | fi |
| 7 | |
| 8 | +dnl Give the chance to enable PAM |
| 9 | +AC_ARG_ENABLE(pam, dnl |
| 10 | +[ --enable-pam Enable use of the PAM libraries], |
| 11 | +[AC_DEFINE(USE_PAM, 1, [Define if you want to use PAM]) |
| 12 | +LIB_PAM="-ldl -lpam -lpam_misc" |
| 13 | +AC_SUBST(LIB_PAM)]) |
| 14 | + |
| 15 | AC_FUNC_FORK |
| 16 | |
| 17 | optional_bin_progs= |
| 18 | diff -urNp coreutils-8.0-orig/configure.ac.orig coreutils-8.0/configure.ac.orig |
| 19 | --- coreutils-8.0-orig/configure.ac.orig 1970-01-01 01:00:00.000000000 +0100 |
| 20 | +++ coreutils-8.0/configure.ac.orig 2009-09-29 15:27:11.000000000 +0200 |
| 21 | @@ -0,0 +1,439 @@ |
| 22 | +# -*- autoconf -*- |
| 23 | +# Process this file with autoconf to produce a configure script. |
| 24 | + |
| 25 | +# Copyright (C) 1991, 1993-2009 Free Software Foundation, Inc. |
| 26 | + |
| 27 | +# This program is free software: you can redistribute it and/or modify |
| 28 | +# it under the terms of the GNU General Public License as published by |
| 29 | +# the Free Software Foundation, either version 3 of the License, or |
| 30 | +# (at your option) any later version. |
| 31 | + |
| 32 | +# This program is distributed in the hope that it will be useful, |
| 33 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 34 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 35 | +# GNU General Public License for more details. |
| 36 | + |
| 37 | +# You should have received a copy of the GNU General Public License |
| 38 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 39 | + |
| 40 | +dnl Written by Jim Meyering. |
| 41 | + |
| 42 | +AC_PREREQ([2.61]) |
| 43 | + |
| 44 | +# Make inter-release version strings look like, e.g., v6.9-219-g58ddd, which |
| 45 | +# indicates that it is built from the 219th delta (in _some_ repository) |
| 46 | +# following the v6.9 tag, and that 58ddd is a prefix of the commit SHA1. |
| 47 | +AC_INIT([GNU coreutils], |
| 48 | + m4_esyscmd([build-aux/git-version-gen .tarball-version]), |
| 49 | + [bug-coreutils@gnu.org]) |
| 50 | + |
| 51 | +AC_CONFIG_SRCDIR([src/ls.c]) |
| 52 | + |
| 53 | +AC_CONFIG_AUX_DIR([build-aux]) |
| 54 | +AC_CONFIG_HEADERS([lib/config.h:lib/config.hin]) |
| 55 | + |
| 56 | +AM_INIT_AUTOMAKE([1.11 dist-xz color-tests parallel-tests]) |
| 57 | +AM_SILENT_RULES([yes]) # make --enable-silent-rules the default. |
| 58 | + |
| 59 | +AC_PROG_CC_STDC |
| 60 | +AM_PROG_CC_C_O |
| 61 | +AC_PROG_CPP |
| 62 | +AC_PROG_GCC_TRADITIONAL |
| 63 | +AC_PROG_RANLIB |
| 64 | +AC_PROG_LN_S |
| 65 | +gl_EARLY |
| 66 | +gl_INIT |
| 67 | +coreutils_MACROS |
| 68 | + |
| 69 | +AC_ARG_ENABLE([gcc-warnings], |
| 70 | + [AS_HELP_STRING([--enable-gcc-warnings], |
| 71 | + [turn on lots of GCC warnings (for developers)])], |
| 72 | + [case $enableval in |
| 73 | + yes|no) ;; |
| 74 | + *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; |
| 75 | + esac |
| 76 | + gl_gcc_warnings=$enableval], |
| 77 | + [gl_gcc_warnings=no] |
| 78 | +) |
| 79 | + |
| 80 | +if test "$gl_gcc_warnings" = yes; then |
| 81 | + gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) |
| 82 | + AC_SUBST([WERROR_CFLAGS]) |
| 83 | + |
| 84 | + nw= |
| 85 | + # This, $nw, is the list of warnings we disable. |
| 86 | + nw="$nw -Wdeclaration-after-statement" # too useful to forbid |
| 87 | + nw="$nw -Waggregate-return" # anachronistic |
| 88 | + nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h) |
| 89 | + nw="$nw -Wc++-compat" # We don't care about C++ compilers |
| 90 | + nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib |
| 91 | + nw="$nw -Wtraditional" # Warns on #elif which we use often |
| 92 | + nw="$nw -Wcast-qual" # Too many warnings for now |
| 93 | + nw="$nw -Wconversion" # Too many warnings for now |
| 94 | + nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings |
| 95 | + nw="$nw -Wsign-conversion" # Too many warnings for now |
| 96 | + nw="$nw -Wtraditional-conversion" # Too many warnings for now |
| 97 | + nw="$nw -Wunreachable-code" # Too many warnings for now |
| 98 | + nw="$nw -Wpadded" # Our structs are not padded |
| 99 | + nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat |
| 100 | + nw="$nw -Wlogical-op" # any use of fwrite provokes this |
| 101 | + nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses |
| 102 | + nw="$nw -Wvla" # warnings in gettext.h |
| 103 | + nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__ |
| 104 | + nw="$nw -Wswitch-enum" # Too many warnings for now |
| 105 | + nw="$nw -Wswitch-default" # Too many warnings for now |
| 106 | + nw="$nw -Wstack-protector" # not worth working around |
| 107 | + # things I might fix soon: |
| 108 | + nw="$nw -Wfloat-equal" # sort.c, seq.c |
| 109 | + nw="$nw -Wmissing-format-attribute" # copy.c |
| 110 | + nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c |
| 111 | + nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot |
| 112 | + nw="$nw -Wstrict-overflow" # expr.c, pr.c, tr.c, factor.c |
| 113 | + # ?? -Wstrict-overflow |
| 114 | + |
| 115 | + gl_MANYWARN_ALL_GCC([ws]) |
| 116 | + gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw]) |
| 117 | + for w in $ws; do |
| 118 | + gl_WARN_ADD([$w]) |
| 119 | + done |
| 120 | + gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one |
| 121 | + gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now |
| 122 | + gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now |
| 123 | + gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now |
| 124 | + |
| 125 | + # In spite of excluding -Wlogical-op above, it is enabled, as of |
| 126 | + # gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c |
| 127 | + gl_WARN_ADD([-Wno-logical-op]) |
| 128 | + |
| 129 | + gl_WARN_ADD([-fdiagnostics-show-option]) |
| 130 | + |
| 131 | + AC_SUBST([WARN_CFLAGS]) |
| 132 | + |
| 133 | + AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.]) |
| 134 | + AC_DEFINE([_FORTIFY_SOURCE], [2], |
| 135 | + [enable compile-time and run-time bounds-checking, and some warnings]) |
| 136 | + AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks]) |
| 137 | +fi |
| 138 | + |
| 139 | +AC_FUNC_FORK |
| 140 | + |
| 141 | +optional_bin_progs= |
| 142 | +AC_CHECK_FUNCS([uname], |
| 143 | + gl_ADD_PROG([optional_bin_progs], [uname])) |
| 144 | +AC_CHECK_FUNCS([chroot], |
| 145 | + gl_ADD_PROG([optional_bin_progs], [chroot])) |
| 146 | +AC_CHECK_FUNCS([gethostid], |
| 147 | + gl_ADD_PROG([optional_bin_progs], [hostid])) |
| 148 | + |
| 149 | +gl_WINSIZE_IN_PTEM |
| 150 | + |
| 151 | +AC_MSG_CHECKING([whether localtime caches TZ]) |
| 152 | +AC_CACHE_VAL([utils_cv_localtime_cache], |
| 153 | +[if test x$ac_cv_func_tzset = xyes; then |
| 154 | +AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h> |
| 155 | +#if STDC_HEADERS |
| 156 | +# include <stdlib.h> |
| 157 | +#endif |
| 158 | +extern char **environ; |
| 159 | +void unset_TZ (void) |
| 160 | +{ |
| 161 | + char **from, **to; |
| 162 | + for (to = from = environ; (*to = *from); from++) |
| 163 | + if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '=')) |
| 164 | + to++; |
| 165 | +} |
| 166 | +int main() |
| 167 | +{ |
| 168 | + time_t now = time ((time_t *) 0); |
| 169 | + int hour_GMT0, hour_unset; |
| 170 | + if (putenv ("TZ=GMT0") != 0) |
| 171 | + exit (1); |
| 172 | + hour_GMT0 = localtime (&now)->tm_hour; |
| 173 | + unset_TZ (); |
| 174 | + hour_unset = localtime (&now)->tm_hour; |
| 175 | + if (putenv ("TZ=PST8") != 0) |
| 176 | + exit (1); |
| 177 | + if (localtime (&now)->tm_hour == hour_GMT0) |
| 178 | + exit (1); |
| 179 | + unset_TZ (); |
| 180 | + if (localtime (&now)->tm_hour != hour_unset) |
| 181 | + exit (1); |
| 182 | + exit (0); |
| 183 | +}]])], |
| 184 | +[utils_cv_localtime_cache=no], |
| 185 | +[utils_cv_localtime_cache=yes], |
| 186 | +[# If we have tzset, assume the worst when cross-compiling. |
| 187 | +utils_cv_localtime_cache=yes]) |
| 188 | +else |
| 189 | + # If we lack tzset, report that localtime does not cache TZ, |
| 190 | + # since we can't invalidate the cache if we don't have tzset. |
| 191 | + utils_cv_localtime_cache=no |
| 192 | +fi])dnl |
| 193 | +AC_MSG_RESULT([$utils_cv_localtime_cache]) |
| 194 | +if test $utils_cv_localtime_cache = yes; then |
| 195 | + AC_DEFINE([LOCALTIME_CACHE], [1], [FIXME]) |
| 196 | +fi |
| 197 | + |
| 198 | +# SCO-ODT-3.0 is reported to need -los to link programs using initgroups |
| 199 | +AC_CHECK_FUNCS([initgroups]) |
| 200 | +if test $ac_cv_func_initgroups = no; then |
| 201 | + AC_CHECK_LIB([os], [initgroups]) |
| 202 | +fi |
| 203 | + |
| 204 | +AC_CHECK_FUNCS([syslog]) |
| 205 | +if test $ac_cv_func_syslog = no; then |
| 206 | + # syslog is not in the default libraries. See if it's in some other. |
| 207 | + for lib in bsd socket inet; do |
| 208 | + AC_CHECK_LIB([$lib], [syslog], [AC_DEFINE([HAVE_SYSLOG], [1], [FIXME]) |
| 209 | + LIBS="$LIBS -l$lib"; break]) |
| 210 | + done |
| 211 | +fi |
| 212 | + |
| 213 | +AC_CACHE_CHECK([for 3-argument setpriority function], |
| 214 | + [utils_cv_func_setpriority], |
| 215 | + [AC_LINK_IFELSE( |
| 216 | + [AC_LANG_PROGRAM( |
| 217 | + [[#include <sys/time.h> |
| 218 | + #include <sys/resource.h> |
| 219 | + ]], |
| 220 | + [[setpriority (0, 0, 0);]])], |
| 221 | + [utils_cv_func_setpriority=yes], |
| 222 | + [utils_cv_func_setpriority=no])]) |
| 223 | +if test $utils_cv_func_setpriority = no; then |
| 224 | + AC_CHECK_FUNCS([nice]) |
| 225 | +fi |
| 226 | +case $utils_cv_func_setpriority,$ac_cv_func_nice in |
| 227 | +*yes*) |
| 228 | + gl_ADD_PROG([optional_bin_progs], [nice]) |
| 229 | +esac |
| 230 | + |
| 231 | +AC_DEFUN([coreutils_DUMMY_1], |
| 232 | +[ |
| 233 | + AC_REQUIRE([gl_READUTMP]) |
| 234 | + if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then |
| 235 | + gl_ADD_PROG([optional_bin_progs], [who]) |
| 236 | + gl_ADD_PROG([optional_bin_progs], [users]) |
| 237 | + gl_ADD_PROG([optional_bin_progs], [pinky]) |
| 238 | + fi |
| 239 | +]) |
| 240 | +coreutils_DUMMY_1 |
| 241 | + |
| 242 | +AC_MSG_CHECKING([ut_host in struct utmp]) |
| 243 | +AC_CACHE_VAL([su_cv_func_ut_host_in_utmp], |
| 244 | +[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
| 245 | +#include <utmp.h>]], [[struct utmp ut; return !sizeof ut.ut_host;]])], |
| 246 | + [su_cv_func_ut_host_in_utmp=yes], |
| 247 | + [su_cv_func_ut_host_in_utmp=no])]) |
| 248 | +AC_MSG_RESULT([$su_cv_func_ut_host_in_utmp]) |
| 249 | +if test $su_cv_func_ut_host_in_utmp = yes; then |
| 250 | + have_ut_host=1 |
| 251 | + AC_DEFINE([HAVE_UT_HOST], [1], [FIXME]) |
| 252 | +fi |
| 253 | + |
| 254 | +if test -z "$have_ut_host"; then |
| 255 | + AC_MSG_CHECKING([ut_host in struct utmpx]) |
| 256 | + AC_CACHE_VAL([su_cv_func_ut_host_in_utmpx], |
| 257 | + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
| 258 | +#include <utmpx.h>]], [[struct utmpx ut; return !sizeof ut.ut_host;]])], |
| 259 | + [su_cv_func_ut_host_in_utmpx=yes], |
| 260 | + [su_cv_func_ut_host_in_utmpx=no])]) |
| 261 | + AC_MSG_RESULT([$su_cv_func_ut_host_in_utmpx]) |
| 262 | + if test $su_cv_func_ut_host_in_utmpx = yes; then |
| 263 | + AC_DEFINE([HAVE_UTMPX_H], [1], [FIXME]) |
| 264 | + AC_DEFINE([HAVE_UT_HOST], [1], [FIXME]) |
| 265 | + fi |
| 266 | +fi |
| 267 | + |
| 268 | +GNULIB_BOOT_TIME([gl_ADD_PROG([optional_bin_progs], [uptime])]) |
| 269 | + |
| 270 | +AC_SYS_POSIX_TERMIOS() |
| 271 | +gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL |
| 272 | + |
| 273 | +if test $ac_cv_sys_posix_termios = yes; then |
| 274 | + gl_ADD_PROG([optional_bin_progs], [stty]) |
| 275 | + |
| 276 | + AC_MSG_CHECKING([whether termios.h needs _XOPEN_SOURCE]) |
| 277 | + AC_CACHE_VAL([su_cv_sys_termios_needs_xopen_source], |
| 278 | + [AC_EGREP_CPP([yes], [#include <termios.h> |
| 279 | +#ifdef IUCLC |
| 280 | +yes |
| 281 | +#endif], su_cv_sys_termios_needs_xopen_source=no, |
| 282 | + AC_EGREP_CPP([yes], [#define _XOPEN_SOURCE |
| 283 | +#include <termios.h> |
| 284 | +#ifdef IUCLC |
| 285 | +yes |
| 286 | +#endif], su_cv_sys_termios_needs_xopen_source=yes, |
| 287 | + su_cv_sys_termios_needs_xopen_source=no))]) |
| 288 | + AC_MSG_RESULT([$su_cv_sys_termios_needs_xopen_source]) |
| 289 | + test $su_cv_sys_termios_needs_xopen_source = yes && |
| 290 | + AC_DEFINE([TERMIOS_NEEDS_XOPEN_SOURCE], [1], [FIXME]) |
| 291 | + |
| 292 | + AC_MSG_CHECKING([c_line in struct termios]) |
| 293 | + AC_CACHE_VAL([su_cv_sys_c_line_in_termios], |
| 294 | + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE |
| 295 | +#define _XOPEN_SOURCE |
| 296 | +#endif |
| 297 | +#include <sys/types.h> |
| 298 | +#include <termios.h>]], [[struct termios t; return !sizeof t.c_line;]])], |
| 299 | + [su_cv_sys_c_line_in_termios=yes], |
| 300 | + [su_cv_sys_c_line_in_termios=no])]) |
| 301 | + AC_MSG_RESULT([$su_cv_sys_c_line_in_termios]) |
| 302 | + test $su_cv_sys_c_line_in_termios = yes \ |
| 303 | + && AC_DEFINE([HAVE_C_LINE], [1], [FIXME]) |
| 304 | +fi |
| 305 | + |
| 306 | +# FIXME: note that this macro appears above, too. |
| 307 | +# I'm leaving it here for now. This whole thing needs to be modernized... |
| 308 | +gl_WINSIZE_IN_PTEM |
| 309 | + |
| 310 | +gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H |
| 311 | + |
| 312 | +if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \ |
| 313 | + test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then |
| 314 | + AC_MSG_CHECKING([TIOCGWINSZ in sys/pty.h]) |
| 315 | + AC_CACHE_VAL([su_cv_sys_tiocgwinsz_in_sys_pty_h], |
| 316 | + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
| 317 | +#ifdef WINSIZE_IN_PTEM |
| 318 | +# include <sys/stream.h> |
| 319 | +# include <sys/ptem.h> |
| 320 | +#endif |
| 321 | +#include <sys/ioctl.h> |
| 322 | +#include <sys/tty.h> |
| 323 | +#include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])], |
| 324 | + [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes], |
| 325 | + [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])]) |
| 326 | + AC_MSG_RESULT([$su_cv_sys_tiocgwinsz_in_sys_pty_h]) |
| 327 | + |
| 328 | + test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \ |
| 329 | + && AC_DEFINE([GWINSZ_IN_SYS_PTY], [1], |
| 330 | + [Define if your system defines TIOCGWINSZ in sys/pty.h.]) |
| 331 | +fi |
| 332 | + |
| 333 | +# For src/kill.c. |
| 334 | +AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , , |
| 335 | + [AC_INCLUDES_DEFAULT |
| 336 | +#include <signal.h>]) |
| 337 | + |
| 338 | +cu_LIB_CHECK |
| 339 | +cu_GMP |
| 340 | + |
| 341 | +# Build df only if there's a point to it. |
| 342 | +if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then |
| 343 | + gl_ADD_PROG([optional_bin_progs], [df]) |
| 344 | +fi |
| 345 | + |
| 346 | +# Limit stdbuf to ELF systems with GCC |
| 347 | +optional_pkglib_progs= |
| 348 | +AC_MSG_CHECKING([whether this is an ELF system]) |
| 349 | +AC_EGREP_CPP([yes], [#if __ELF__ |
| 350 | +yes |
| 351 | +#endif], [elf_sys=yes], [elf_sys=no]) |
| 352 | +AC_MSG_RESULT([$elf_sys]) |
| 353 | +if test "$elf_sys" = "yes" && \ |
| 354 | + test "$GCC" = "yes"; then |
| 355 | + gl_ADD_PROG([optional_bin_progs], [stdbuf]) |
| 356 | + gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so]) |
| 357 | +fi |
| 358 | + |
| 359 | +############################################################################ |
| 360 | +mk="$srcdir/src/Makefile.am" |
| 361 | +# Extract all literal names from the definition of $(EXTRA_PROGRAMS) |
| 362 | +# in $mk but don't expand the variable references. |
| 363 | +# Append each literal name to $optional_bin_progs. |
| 364 | +v=EXTRA_PROGRAMS |
| 365 | +for gl_i in `sed -n '/^'$v' =/,/[[^\]]$/p' $mk \ |
| 366 | + | sed 's/^ *//;/^\$.*/d;/^'$v' =/d' \ |
| 367 | + | tr -s '\\015\\012\\\\' ' '`; do |
| 368 | + gl_ADD_PROG([optional_bin_progs], $gl_i) |
| 369 | +done |
| 370 | + |
| 371 | +# As above, extract literal names from the definition of $(no_install__progs) |
| 372 | +# in $mk but don't expand the variable references. |
| 373 | +v=no_install__progs |
| 374 | +t=`sed -n '/^'$v' =/,/[[^\]]$/p' $mk \ |
| 375 | + | sed 's/^ *//;/^\$.*/d;/^'$v' =/d' \ |
| 376 | + | tr -s '\\015\\012\\\\' ' '` |
| 377 | +# Remove any trailing space. |
| 378 | +no_install_progs_default=`echo "$t"|sed 's/ $//'` |
| 379 | + |
| 380 | +# Unfortunately, due to the way autoconf's AS_HELP_STRING works, the list |
| 381 | +# of default-not-installed programs, "arch hostname su", must appear in two |
| 382 | +# places: in this file below, and in $mk. Using "$no_install_progs_default" |
| 383 | +# below cannot work. And we can't substitute the names into $mk because |
| 384 | +# automake needs the literals, too. |
| 385 | +# The compromise is to ensure that the space-separated list extracted |
| 386 | +# above matches the literal 2nd argument below. |
| 387 | +c="$srcdir/configure.ac" |
| 388 | +re='^g''l_INCLUDE_EXCLUDE_PROG(.* [\[\(.*\)\]])' |
| 389 | +t=`sed -n '/'"$re"'/{s/'"$re"'/\1/;s/,/ /gp |
| 390 | +}' $c` |
| 391 | +case $t in |
| 392 | + $no_install_progs_default) ;; |
| 393 | + *) AC_MSG_ERROR([[internal error: g'l_INCLUDE_EXCLUDE_PROG's 2nd arg, $t, |
| 394 | + does not match the list of default-not-installed programs |
| 395 | + ($no_install_progs_default) also recorded in $mk]], |
| 396 | + 1) ;; |
| 397 | +esac |
| 398 | + |
| 399 | +# Given the name of a variable containing a space-separated list of |
| 400 | +# install-by-default programs and the actual list do-not-install-by-default |
| 401 | +# programs, modify the former variable to reflect any "do-install" and |
| 402 | +# "don't-install" requests. |
| 403 | +# I.e., add any program name specified via --enable-install-program=..., and |
| 404 | +# remove any program name specified via --enable-no-install-program=... |
| 405 | +# Note how the second argument below is a literal, with "," separators. |
| 406 | +# That is required due to the way the macro works, and since the |
| 407 | +# corresponding ./configure option argument is comma-separated on input. |
| 408 | +gl_INCLUDE_EXCLUDE_PROG([optional_bin_progs], [arch,hostname,su]) |
| 409 | + |
| 410 | +# Set INSTALL_SU if su installation has been requested via |
| 411 | +# --enable-install-program=su. |
| 412 | +AC_SUBST([INSTALL_SU]) |
| 413 | +case " $optional_bin_progs " in |
| 414 | + *' su '*) INSTALL_SU=yes ;; |
| 415 | + *) INSTALL_SU=no ;; |
| 416 | +esac |
| 417 | + |
| 418 | +MAN=`echo "$optional_bin_progs "|sed 's/ /.1 /g;s/ $//'|tr -d '\\015\\012'` |
| 419 | + |
| 420 | +# Change ginstall.1 to "install.h" in $MAN. |
| 421 | +MAN=`for m in $MAN; do test $m = ginstall.1 && m=install.1; echo $m; done \ |
| 422 | + | tr '\015\012' ' '; echo` |
| 423 | + |
| 424 | +# Remove [.1, since writing a portable rule for it in man/Makefile.am |
| 425 | +# is not practical. The sed LHS below uses the autoconf quadrigraph |
| 426 | +# representing '['. |
| 427 | +MAN=`echo "$MAN"|sed 's/\@<:@\.1//'` |
| 428 | + |
| 429 | +OPTIONAL_BIN_PROGS=`echo "$optional_bin_progs "|sed 's/ /\$(EXEEXT) /g;s/ $//'` |
| 430 | +AC_SUBST([OPTIONAL_BIN_PROGS]) |
| 431 | +OPTIONAL_PKGLIB_PROGS=`echo "$optional_pkglib_progs " | sed 's/ $//'` |
| 432 | +AC_SUBST([OPTIONAL_PKGLIB_PROGS]) |
| 433 | +NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default |
| 434 | +AC_SUBST([NO_INSTALL_PROGS_DEFAULT]) |
| 435 | + |
| 436 | +AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes]) |
| 437 | + |
| 438 | +# Arrange to rerun configure whenever the file, src/Makefile.am, |
| 439 | +# containing the list of program names changes. |
| 440 | +CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/src/Makefile.am' |
| 441 | +AC_SUBST([CONFIG_STATUS_DEPENDENCIES]) |
| 442 | +############################################################################ |
| 443 | + |
| 444 | +AM_GNU_GETTEXT([external], [need-formatstring-macros]) |
| 445 | +AM_GNU_GETTEXT_VERSION([0.15]) |
| 446 | + |
| 447 | +# For a test of uniq: it uses the $LOCALE_FR envvar. |
| 448 | +gt_LOCALE_FR |
| 449 | + |
| 450 | +AC_CONFIG_FILES( |
| 451 | + Makefile |
| 452 | + doc/Makefile |
| 453 | + lib/Makefile |
| 454 | + man/Makefile |
| 455 | + po/Makefile.in |
| 456 | + src/Makefile |
| 457 | + tests/Makefile |
| 458 | + gnulib-tests/Makefile |
| 459 | + ) |
| 460 | +AC_OUTPUT |
| 461 | diff -urNp coreutils-8.0-orig/doc/coreutils.texi coreutils-8.0/doc/coreutils.texi |
| 462 | --- coreutils-8.0-orig/doc/coreutils.texi 2009-09-29 15:27:54.000000000 +0200 |
| 463 | +++ coreutils-8.0/doc/coreutils.texi 2009-10-07 10:04:27.000000000 +0200 |
| 464 | @@ -14742,8 +14742,11 @@ to certain shells, etc.). |
| 465 | @findex syslog |
| 466 | @command{su} can optionally be compiled to use @code{syslog} to report |
| 467 | failed, and optionally successful, @command{su} attempts. (If the system |
| 468 | -supports @code{syslog}.) However, GNU @command{su} does not check if the |
| 469 | -user is a member of the @code{wheel} group; see below. |
| 470 | +supports @code{syslog}.) |
| 471 | + |
| 472 | +This version of @command{su} has support for using PAM for |
| 473 | +authentication. You can edit @file{/etc/pam.d/su} to customize its |
| 474 | +behaviour. |
| 475 | |
| 476 | The program accepts the following options. Also see @ref{Common options}. |
| 477 | |
| 478 | @@ -14785,6 +14788,8 @@ environment variables except @env{TERM}, |
| 479 | @env{PATH} to a compiled-in default value. Change to @var{user}'s home |
| 480 | directory. Prepend @samp{-} to the shell's name, intended to make it |
| 481 | read its login startup file(s). |
| 482 | +Additionaly @env{DISPLAY} and @env{XAUTHORITY} environment variables |
| 483 | +are preserved as well for PAM functionality. |
| 484 | |
| 485 | @item -m |
| 486 | @itemx -p |
| 487 | @@ -14824,33 +14829,6 @@ Exit status: |
| 488 | the exit status of the subshell otherwise |
| 489 | @end display |
| 490 | |
| 491 | -@cindex wheel group, not supported |
| 492 | -@cindex group wheel, not supported |
| 493 | -@cindex fascism |
| 494 | -@subsection Why GNU @command{su} does not support the @samp{wheel} group |
| 495 | - |
| 496 | -(This section is by Richard Stallman.) |
| 497 | - |
| 498 | -@cindex Twenex |
| 499 | -@cindex MIT AI lab |
| 500 | -Sometimes a few of the users try to hold total power over all the |
| 501 | -rest. For example, in 1984, a few users at the MIT AI lab decided to |
| 502 | -seize power by changing the operator password on the Twenex system and |
| 503 | -keeping it secret from everyone else. (I was able to thwart this coup |
| 504 | -and give power back to the users by patching the kernel, but I |
| 505 | -wouldn't know how to do that in Unix.) |
| 506 | - |
| 507 | -However, occasionally the rulers do tell someone. Under the usual |
| 508 | -@command{su} mechanism, once someone learns the root password who |
| 509 | -sympathizes with the ordinary users, he or she can tell the rest. The |
| 510 | -``wheel group'' feature would make this impossible, and thus cement the |
| 511 | -power of the rulers. |
| 512 | - |
| 513 | -I'm on the side of the masses, not that of the rulers. If you are |
| 514 | -used to supporting the bosses and sysadmins in whatever they do, you |
| 515 | -might find this idea strange at first. |
| 516 | - |
| 517 | - |
| 518 | @node timeout invocation |
| 519 | @section @command{timeout}: Run a command with a time limit |
| 520 | |
| 521 | diff -urNp coreutils-8.0-orig/doc/coreutils.texi.orig coreutils-8.0/doc/coreutils.texi.orig |
| 522 | --- coreutils-8.0-orig/doc/coreutils.texi.orig 1970-01-01 01:00:00.000000000 +0100 |
| 523 | +++ coreutils-8.0/doc/coreutils.texi.orig 2009-09-29 15:27:54.000000000 +0200 |
| 524 | @@ -0,0 +1,15835 @@ |
| 525 | +\input texinfo |
| 526 | +@c %**start of header |
| 527 | +@setfilename coreutils.info |
| 528 | +@settitle @sc{gnu} Coreutils |
| 529 | + |
| 530 | +@c %**end of header |
| 531 | + |
| 532 | +@include version.texi |
| 533 | +@include constants.texi |
| 534 | + |
| 535 | +@c Define new indices. |
| 536 | +@defcodeindex op |
| 537 | +@defcodeindex fl |
| 538 | + |
| 539 | +@c Put everything in one index (arbitrarily chosen to be the concept index). |
| 540 | +@syncodeindex fl cp |
| 541 | +@syncodeindex fn cp |
| 542 | +@syncodeindex ky cp |
| 543 | +@syncodeindex op cp |
| 544 | +@syncodeindex pg cp |
| 545 | +@syncodeindex vr cp |
| 546 | + |
| 547 | +@dircategory Basics |
| 548 | +@direntry |
| 549 | +* Coreutils: (coreutils). Core GNU (file, text, shell) utilities. |
| 550 | +* Common options: (coreutils)Common options. Common options. |
| 551 | +* File permissions: (coreutils)File permissions. Access modes. |
| 552 | +* Date input formats: (coreutils)Date input formats. |
| 553 | +@end direntry |
| 554 | + |
| 555 | +@c FIXME: the following need documentation |
| 556 | +@c * [: (coreutils)[ invocation. File/string tests. |
| 557 | +@c * pinky: (coreutils)pinky invocation. FIXME. |
| 558 | +@c * mktemp: (coreutils)mktemp invocation. FIXME. |
| 559 | + |
| 560 | +@dircategory Individual utilities |
| 561 | +@direntry |
| 562 | +* arch: (coreutils)arch invocation. Print machine hardware name. |
| 563 | +* base64: (coreutils)base64 invocation. Base64 encode/decode data. |
| 564 | +* basename: (coreutils)basename invocation. Strip directory and suffix. |
| 565 | +* cat: (coreutils)cat invocation. Concatenate and write files. |
| 566 | +* chcon: (coreutils)chcon invocation. Change SELinux CTX of files. |
| 567 | +* chgrp: (coreutils)chgrp invocation. Change file groups. |
| 568 | +* chmod: (coreutils)chmod invocation. Change file permissions. |
| 569 | +* chown: (coreutils)chown invocation. Change file owners/groups. |
| 570 | +* chroot: (coreutils)chroot invocation. Specify the root directory. |
| 571 | +* cksum: (coreutils)cksum invocation. Print POSIX CRC checksum. |
| 572 | +* comm: (coreutils)comm invocation. Compare sorted files by line. |
| 573 | +* cp: (coreutils)cp invocation. Copy files. |
| 574 | +* csplit: (coreutils)csplit invocation. Split by context. |
| 575 | +* cut: (coreutils)cut invocation. Print selected parts of lines. |
| 576 | +* date: (coreutils)date invocation. Print/set system date and time. |
| 577 | +* dd: (coreutils)dd invocation. Copy and convert a file. |
| 578 | +* df: (coreutils)df invocation. Report file system disk usage. |
| 579 | +* dir: (coreutils)dir invocation. List directories briefly. |
| 580 | +* dircolors: (coreutils)dircolors invocation. Color setup for ls. |
| 581 | +* dirname: (coreutils)dirname invocation. Strip non-directory suffix. |
| 582 | +* du: (coreutils)du invocation. Report on disk usage. |
| 583 | +* echo: (coreutils)echo invocation. Print a line of text. |
| 584 | +* env: (coreutils)env invocation. Modify the environment. |
| 585 | +* expand: (coreutils)expand invocation. Convert tabs to spaces. |
| 586 | +* expr: (coreutils)expr invocation. Evaluate expressions. |
| 587 | +* factor: (coreutils)factor invocation. Print prime factors |
| 588 | +* false: (coreutils)false invocation. Do nothing, unsuccessfully. |
| 589 | +* fmt: (coreutils)fmt invocation. Reformat paragraph text. |
| 590 | +* fold: (coreutils)fold invocation. Wrap long input lines. |
| 591 | +* groups: (coreutils)groups invocation. Print group names a user is in. |
| 592 | +* head: (coreutils)head invocation. Output the first part of files. |
| 593 | +* hostid: (coreutils)hostid invocation. Print numeric host identifier. |
| 594 | +* hostname: (coreutils)hostname invocation. Print or set system name. |
| 595 | +* id: (coreutils)id invocation. Print user identity. |
| 596 | +* install: (coreutils)install invocation. Copy and change attributes. |
| 597 | +* join: (coreutils)join invocation. Join lines on a common field. |
| 598 | +* kill: (coreutils)kill invocation. Send a signal to processes. |
| 599 | +* link: (coreutils)link invocation. Make hard links between files. |
| 600 | +* ln: (coreutils)ln invocation. Make links between files. |
| 601 | +* logname: (coreutils)logname invocation. Print current login name. |
| 602 | +* ls: (coreutils)ls invocation. List directory contents. |
| 603 | +* md5sum: (coreutils)md5sum invocation. Print or check MD5 digests. |
| 604 | +* mkdir: (coreutils)mkdir invocation. Create directories. |
| 605 | +* mkfifo: (coreutils)mkfifo invocation. Create FIFOs (named pipes). |
| 606 | +* mknod: (coreutils)mknod invocation. Create special files. |
| 607 | +* mv: (coreutils)mv invocation. Rename files. |
| 608 | +* nice: (coreutils)nice invocation. Modify niceness. |
| 609 | +* nl: (coreutils)nl invocation. Number lines and write files. |
| 610 | +* nohup: (coreutils)nohup invocation. Immunize to hangups. |
| 611 | +* od: (coreutils)od invocation. Dump files in octal, etc. |
| 612 | +* paste: (coreutils)paste invocation. Merge lines of files. |
| 613 | +* pathchk: (coreutils)pathchk invocation. Check file name portability. |
| 614 | +* pr: (coreutils)pr invocation. Paginate or columnate files. |
| 615 | +* printenv: (coreutils)printenv invocation. Print environment variables. |
| 616 | +* printf: (coreutils)printf invocation. Format and print data. |
| 617 | +* ptx: (coreutils)ptx invocation. Produce permuted indexes. |
| 618 | +* pwd: (coreutils)pwd invocation. Print working directory. |
| 619 | +* readlink: (coreutils)readlink invocation. Print referent of a symlink. |
| 620 | +* rm: (coreutils)rm invocation. Remove files. |
| 621 | +* rmdir: (coreutils)rmdir invocation. Remove empty directories. |
| 622 | +* runcon: (coreutils)runcon invocation. Run in specified SELinux CTX. |
| 623 | +* seq: (coreutils)seq invocation. Print numeric sequences |
| 624 | +* sha1sum: (coreutils)sha1sum invocation. Print or check SHA-1 digests. |
| 625 | +* sha2: (coreutils)sha2 utilities. Print or check SHA-2 digests. |
| 626 | +* shred: (coreutils)shred invocation. Remove files more securely. |
| 627 | +* shuf: (coreutils)shuf invocation. Shuffling text files. |
| 628 | +* sleep: (coreutils)sleep invocation. Delay for a specified time. |
| 629 | +* sort: (coreutils)sort invocation. Sort text files. |
| 630 | +* split: (coreutils)split invocation. Split into fixed-size pieces. |
| 631 | +* stat: (coreutils)stat invocation. Report file(system) status. |
| 632 | +* stdbuf: (coreutils)stdbuf invocation. Modify stdio buffering. |
| 633 | +* stty: (coreutils)stty invocation. Print/change terminal settings. |
| 634 | +* su: (coreutils)su invocation. Modify user and group ID. |
| 635 | +* sum: (coreutils)sum invocation. Print traditional checksum. |
| 636 | +* sync: (coreutils)sync invocation. Synchronize memory and disk. |
| 637 | +* tac: (coreutils)tac invocation. Reverse files. |
| 638 | +* tail: (coreutils)tail invocation. Output the last part of files. |
| 639 | +* tee: (coreutils)tee invocation. Redirect to multiple files. |
| 640 | +* test: (coreutils)test invocation. File/string tests. |
| 641 | +* timeout: (coreutils)timeout invocation. Run with time limit. |
| 642 | +* touch: (coreutils)touch invocation. Change file timestamps. |
| 643 | +* tr: (coreutils)tr invocation. Translate characters. |
| 644 | +* true: (coreutils)true invocation. Do nothing, successfully. |
| 645 | +* truncate: (coreutils)truncate invocation. Shrink/extend size of a file. |
| 646 | +* tsort: (coreutils)tsort invocation. Topological sort. |
| 647 | +* tty: (coreutils)tty invocation. Print terminal name. |
| 648 | +* uname: (coreutils)uname invocation. Print system information. |
| 649 | +* unexpand: (coreutils)unexpand invocation. Convert spaces to tabs. |
| 650 | +* uniq: (coreutils)uniq invocation. Uniquify files. |
| 651 | +* unlink: (coreutils)unlink invocation. Removal via unlink(2). |
| 652 | +* uptime: (coreutils)uptime invocation. Print uptime and load. |
| 653 | +* users: (coreutils)users invocation. Print current user names. |
| 654 | +* vdir: (coreutils)vdir invocation. List directories verbosely. |
| 655 | +* wc: (coreutils)wc invocation. Line, word, and byte counts. |
| 656 | +* who: (coreutils)who invocation. Print who is logged in. |
| 657 | +* whoami: (coreutils)whoami invocation. Print effective user ID. |
| 658 | +* yes: (coreutils)yes invocation. Print a string indefinitely. |
| 659 | +@end direntry |
| 660 | + |
| 661 | +@copying |
| 662 | +This manual documents version @value{VERSION} of the @sc{gnu} core |
| 663 | +utilities, including the standard programs for text and file manipulation. |
| 664 | + |
| 665 | +Copyright @copyright{} 1994-1996, 2000-2009 Free Software Foundation, Inc. |
| 666 | + |
| 667 | +@quotation |
| 668 | +Permission is granted to copy, distribute and/or modify this document |
| 669 | +under the terms of the GNU Free Documentation License, Version 1.3 or |
| 670 | +any later version published by the Free Software Foundation; with no |
| 671 | +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover |
| 672 | +Texts. A copy of the license is included in the section entitled ``GNU |
| 673 | +Free Documentation License''. |
| 674 | +@end quotation |
| 675 | +@end copying |
| 676 | + |
| 677 | +@titlepage |
| 678 | +@title @sc{gnu} @code{Coreutils} |
| 679 | +@subtitle Core GNU utilities |
| 680 | +@subtitle for version @value{VERSION}, @value{UPDATED} |
| 681 | +@author David MacKenzie et al. |
| 682 | + |
| 683 | +@page |
| 684 | +@vskip 0pt plus 1filll |
| 685 | +@insertcopying |
| 686 | +@end titlepage |
| 687 | +@shortcontents |
| 688 | +@contents |
| 689 | + |
| 690 | +@ifnottex |
| 691 | +@node Top |
| 692 | +@top GNU Coreutils |
| 693 | + |
| 694 | +@insertcopying |
| 695 | +@end ifnottex |
| 696 | + |
| 697 | +@cindex core utilities |
| 698 | +@cindex text utilities |
| 699 | +@cindex shell utilities |
| 700 | +@cindex file utilities |
| 701 | + |
| 702 | +@menu |
| 703 | +* Introduction:: Caveats, overview, and authors |
| 704 | +* Common options:: Common options |
| 705 | +* Output of entire files:: cat tac nl od base64 |
| 706 | +* Formatting file contents:: fmt pr fold |
| 707 | +* Output of parts of files:: head tail split csplit |
| 708 | +* Summarizing files:: wc sum cksum md5sum sha1sum sha2 |
| 709 | +* Operating on sorted files:: sort shuf uniq comm ptx tsort |
| 710 | +* Operating on fields:: cut paste join |
| 711 | +* Operating on characters:: tr expand unexpand |
| 712 | +* Directory listing:: ls dir vdir dircolors |
| 713 | +* Basic operations:: cp dd install mv rm shred |
| 714 | +* Special file types:: mkdir rmdir unlink mkfifo mknod ln link readlink |
| 715 | +* Changing file attributes:: chgrp chmod chown touch |
| 716 | +* Disk usage:: df du stat sync truncate |
| 717 | +* Printing text:: echo printf yes |
| 718 | +* Conditions:: false true test expr |
| 719 | +* Redirection:: tee |
| 720 | +* File name manipulation:: dirname basename pathchk |
| 721 | +* Working context:: pwd stty printenv tty |
| 722 | +* User information:: id logname whoami groups users who |
| 723 | +* System context:: date arch uname hostname hostid uptime |
| 724 | +* SELinux context:: chcon runcon |
| 725 | +* Modified command invocation:: chroot env nice nohup stdbuf su timeout |
| 726 | +* Process control:: kill |
| 727 | +* Delaying:: sleep |
| 728 | +* Numeric operations:: factor seq |
| 729 | +* File permissions:: Access modes |
| 730 | +* Date input formats:: Specifying date strings |
| 731 | +* Opening the software toolbox:: The software tools philosophy |
| 732 | +* GNU Free Documentation License:: Copying and sharing this manual |
| 733 | +* Concept index:: General index |
| 734 | + |
| 735 | +@detailmenu |
| 736 | + --- The Detailed Node Listing --- |
| 737 | + |
| 738 | +Common Options |
| 739 | + |
| 740 | +* Exit status:: Indicating program success or failure |
| 741 | +* Backup options:: Backup options |
| 742 | +* Block size:: Block size |
| 743 | +* Signal specifications:: Specifying signals |
| 744 | +* Disambiguating names and IDs:: chgrp and chown owner and group syntax |
| 745 | +* Random sources:: Sources of random data |
| 746 | +* Target directory:: Target directory |
| 747 | +* Trailing slashes:: Trailing slashes |
| 748 | +* Traversing symlinks:: Traversing symlinks to directories |
| 749 | +* Treating / specially:: Treating / specially |
| 750 | +* Standards conformance:: Standards conformance |
| 751 | + |
| 752 | +Output of entire files |
| 753 | + |
| 754 | +* cat invocation:: Concatenate and write files |
| 755 | +* tac invocation:: Concatenate and write files in reverse |
| 756 | +* nl invocation:: Number lines and write files |
| 757 | +* od invocation:: Write files in octal or other formats |
| 758 | +* base64 invocation:: Transform data into printable data |
| 759 | + |
| 760 | +Formatting file contents |
| 761 | + |
| 762 | +* fmt invocation:: Reformat paragraph text |
| 763 | +* pr invocation:: Paginate or columnate files for printing |
| 764 | +* fold invocation:: Wrap input lines to fit in specified width |
| 765 | + |
| 766 | +Output of parts of files |
| 767 | + |
| 768 | +* head invocation:: Output the first part of files |
| 769 | +* tail invocation:: Output the last part of files |
| 770 | +* split invocation:: Split a file into fixed-size pieces |
| 771 | +* csplit invocation:: Split a file into context-determined pieces |
| 772 | + |
| 773 | +Summarizing files |
| 774 | + |
| 775 | +* wc invocation:: Print newline, word, and byte counts |
| 776 | +* sum invocation:: Print checksum and block counts |
| 777 | +* cksum invocation:: Print CRC checksum and byte counts |
| 778 | +* md5sum invocation:: Print or check MD5 digests |
| 779 | +* sha1sum invocation:: Print or check SHA-1 digests |
| 780 | +* sha2 utilities:: Print or check SHA-2 digests |
| 781 | + |
| 782 | +Operating on sorted files |
| 783 | + |
| 784 | +* sort invocation:: Sort text files |
| 785 | +* shuf invocation:: Shuffle text files |
| 786 | +* uniq invocation:: Uniquify files |
| 787 | +* comm invocation:: Compare two sorted files line by line |
| 788 | +* ptx invocation:: Produce a permuted index of file contents |
| 789 | +* tsort invocation:: Topological sort |
| 790 | + |
| 791 | +@command{ptx}: Produce permuted indexes |
| 792 | + |
| 793 | +* General options in ptx:: Options which affect general program behavior |
| 794 | +* Charset selection in ptx:: Underlying character set considerations |
| 795 | +* Input processing in ptx:: Input fields, contexts, and keyword selection |
| 796 | +* Output formatting in ptx:: Types of output format, and sizing the fields |
| 797 | +* Compatibility in ptx:: The @acronym{GNU} extensions to @command{ptx} |
| 798 | + |
| 799 | +Operating on fields |
| 800 | + |
| 801 | +* cut invocation:: Print selected parts of lines |
| 802 | +* paste invocation:: Merge lines of files |
| 803 | +* join invocation:: Join lines on a common field |
| 804 | + |
| 805 | +Operating on characters |
| 806 | + |
| 807 | +* tr invocation:: Translate, squeeze, and/or delete characters |
| 808 | +* expand invocation:: Convert tabs to spaces |
| 809 | +* unexpand invocation:: Convert spaces to tabs |
| 810 | + |
| 811 | +@command{tr}: Translate, squeeze, and/or delete characters |
| 812 | + |
| 813 | +* Character sets:: Specifying sets of characters |
| 814 | +* Translating:: Changing one set of characters to another |
| 815 | +* Squeezing:: Squeezing repeats and deleting |
| 816 | + |
| 817 | +Directory listing |
| 818 | + |
| 819 | +* ls invocation:: List directory contents |
| 820 | +* dir invocation:: Briefly list directory contents |
| 821 | +* vdir invocation:: Verbosely list directory contents |
| 822 | +* dircolors invocation:: Color setup for @command{ls} |
| 823 | + |
| 824 | +@command{ls}: List directory contents |
| 825 | + |
| 826 | +* Which files are listed:: Which files are listed |
| 827 | +* What information is listed:: What information is listed |
| 828 | +* Sorting the output:: Sorting the output |
| 829 | +* Details about version sort:: More details about version sort |
| 830 | +* General output formatting:: General output formatting |
| 831 | +* Formatting the file names:: Formatting the file names |
| 832 | + |
| 833 | +Basic operations |
| 834 | + |
| 835 | +* cp invocation:: Copy files and directories |
| 836 | +* dd invocation:: Convert and copy a file |
| 837 | +* install invocation:: Copy files and set attributes |
| 838 | +* mv invocation:: Move (rename) files |
| 839 | +* rm invocation:: Remove files or directories |
| 840 | +* shred invocation:: Remove files more securely |
| 841 | + |
| 842 | +Special file types |
| 843 | + |
| 844 | +* link invocation:: Make a hard link via the link syscall |
| 845 | +* ln invocation:: Make links between files |
| 846 | +* mkdir invocation:: Make directories |
| 847 | +* mkfifo invocation:: Make FIFOs (named pipes) |
| 848 | +* mknod invocation:: Make block or character special files |
| 849 | +* readlink invocation:: Print value of a symlink or canonical file name |
| 850 | +* rmdir invocation:: Remove empty directories |
| 851 | +* unlink invocation:: Remove files via unlink syscall |
| 852 | + |
| 853 | +Changing file attributes |
| 854 | + |
| 855 | +* chown invocation:: Change file owner and group |
| 856 | +* chgrp invocation:: Change group ownership |
| 857 | +* chmod invocation:: Change access permissions |
| 858 | +* touch invocation:: Change file timestamps |
| 859 | + |
| 860 | +Disk usage |
| 861 | + |
| 862 | +* df invocation:: Report file system disk space usage |
| 863 | +* du invocation:: Estimate file space usage |
| 864 | +* stat invocation:: Report file or file system status |
| 865 | +* sync invocation:: Synchronize data on disk with memory |
| 866 | +* truncate invocation:: Shrink or extend the size of a file |
| 867 | + |
| 868 | +Printing text |
| 869 | + |
| 870 | +* echo invocation:: Print a line of text |
| 871 | +* printf invocation:: Format and print data |
| 872 | +* yes invocation:: Print a string until interrupted |
| 873 | + |
| 874 | +Conditions |
| 875 | + |
| 876 | +* false invocation:: Do nothing, unsuccessfully |
| 877 | +* true invocation:: Do nothing, successfully |
| 878 | +* test invocation:: Check file types and compare values |
| 879 | +* expr invocation:: Evaluate expressions |
| 880 | + |
| 881 | +@command{test}: Check file types and compare values |
| 882 | + |
| 883 | +* File type tests:: File type tests |
| 884 | +* Access permission tests:: Access permission tests |
| 885 | +* File characteristic tests:: File characteristic tests |
| 886 | +* String tests:: String tests |
| 887 | +* Numeric tests:: Numeric tests |
| 888 | + |
| 889 | +@command{expr}: Evaluate expression |
| 890 | + |
| 891 | +* String expressions:: + : match substr index length |
| 892 | +* Numeric expressions:: + - * / % |
| 893 | +* Relations for expr:: | & < <= = == != >= > |
| 894 | +* Examples of expr:: Examples of using @command{expr} |
| 895 | + |
| 896 | +Redirection |
| 897 | + |
| 898 | +* tee invocation:: Redirect output to multiple files or processes |
| 899 | + |
| 900 | +File name manipulation |
| 901 | + |
| 902 | +* basename invocation:: Strip directory and suffix from a file name |
| 903 | +* dirname invocation:: Strip non-directory suffix from a file name |
| 904 | +* pathchk invocation:: Check file name validity and portability |
| 905 | + |
| 906 | +Working context |
| 907 | + |
| 908 | +* pwd invocation:: Print working directory |
| 909 | +* stty invocation:: Print or change terminal characteristics |
| 910 | +* printenv invocation:: Print all or some environment variables |
| 911 | +* tty invocation:: Print file name of terminal on standard input |
| 912 | + |
| 913 | +@command{stty}: Print or change terminal characteristics |
| 914 | + |
| 915 | +* Control:: Control settings |
| 916 | +* Input:: Input settings |
| 917 | +* Output:: Output settings |
| 918 | +* Local:: Local settings |
| 919 | +* Combination:: Combination settings |
| 920 | +* Characters:: Special characters |
| 921 | +* Special:: Special settings |
| 922 | + |
| 923 | +User information |
| 924 | + |
| 925 | +* id invocation:: Print user identity |
| 926 | +* logname invocation:: Print current login name |
| 927 | +* whoami invocation:: Print effective user ID |
| 928 | +* groups invocation:: Print group names a user is in |
| 929 | +* users invocation:: Print login names of users currently logged in |
| 930 | +* who invocation:: Print who is currently logged in |
| 931 | + |
| 932 | +System context |
| 933 | + |
| 934 | +* arch invocation:: Print machine hardware name |
| 935 | +* date invocation:: Print or set system date and time |
| 936 | +* uname invocation:: Print system information |
| 937 | +* hostname invocation:: Print or set system name |
| 938 | +* hostid invocation:: Print numeric host identifier |
| 939 | +* uptime invocation:: Print system uptime and load |
| 940 | + |
| 941 | +@command{date}: Print or set system date and time |
| 942 | + |
| 943 | +* Time conversion specifiers:: %[HIklMNpPrRsSTXzZ] |
| 944 | +* Date conversion specifiers:: %[aAbBcCdDeFgGhjmuUVwWxyY] |
| 945 | +* Literal conversion specifiers:: %[%nt] |
| 946 | +* Padding and other flags:: Pad with zeros, spaces, etc. |
| 947 | +* Setting the time:: Changing the system clock |
| 948 | +* Options for date:: Instead of the current time |
| 949 | +* Date input formats:: Specifying date strings |
| 950 | +* Examples of date:: Examples |
| 951 | + |
| 952 | +SELinux context |
| 953 | + |
| 954 | +* chcon invocation:: Change SELinux context of file |
| 955 | +* runcon invocation:: Run a command in specified SELinux context |
| 956 | + |
| 957 | +Modified command invocation |
| 958 | + |
| 959 | +* chroot invocation:: Run a command with a different root directory |
| 960 | +* env invocation:: Run a command in a modified environment |
| 961 | +* nice invocation:: Run a command with modified niceness |
| 962 | +* nohup invocation:: Run a command immune to hangups |
| 963 | +* stdbuf invocation:: Run a command with modified I/O buffering |
| 964 | +* su invocation:: Run a command with substitute user and group ID |
| 965 | +* timeout invocation:: Run a command with a time limit |
| 966 | + |
| 967 | +Process control |
| 968 | + |
| 969 | +* kill invocation:: Sending a signal to processes. |
| 970 | + |
| 971 | +Delaying |
| 972 | + |
| 973 | +* sleep invocation:: Delay for a specified time |
| 974 | + |
| 975 | +Numeric operations |
| 976 | + |
| 977 | +* factor invocation:: Print prime factors |
| 978 | +* seq invocation:: Print numeric sequences |
| 979 | + |
| 980 | +File permissions |
| 981 | + |
| 982 | +* Mode Structure:: Structure of file mode bits |
| 983 | +* Symbolic Modes:: Mnemonic representation of file mode bits |
| 984 | +* Numeric Modes:: File mode bits as octal numbers |
| 985 | +* Directory Setuid and Setgid:: Set-user-ID and set-group-ID on directories |
| 986 | + |
| 987 | +Date input formats |
| 988 | + |
| 989 | +* General date syntax:: Common rules |
| 990 | +* Calendar date items:: 19 Dec 1994 |
| 991 | +* Time of day items:: 9:20pm |
| 992 | +* Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt} |
| 993 | +* Day of week items:: Monday and others |
| 994 | +* Relative items in date strings:: next tuesday, 2 years ago |
| 995 | +* Pure numbers in date strings:: 19931219, 1440 |
| 996 | +* Seconds since the Epoch:: @@1078100502 |
| 997 | +* Specifying time zone rules:: TZ="America/New_York", TZ="UTC0" |
| 998 | +* Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al |
| 999 | + |
| 1000 | +Opening the software toolbox |
| 1001 | + |
| 1002 | +* Toolbox introduction:: Toolbox introduction |
| 1003 | +* I/O redirection:: I/O redirection |
| 1004 | +* The who command:: The @command{who} command |
| 1005 | +* The cut command:: The @command{cut} command |
| 1006 | +* The sort command:: The @command{sort} command |
| 1007 | +* The uniq command:: The @command{uniq} command |
| 1008 | +* Putting the tools together:: Putting the tools together |
| 1009 | + |
| 1010 | +Copying This Manual |
| 1011 | + |
| 1012 | +* GNU Free Documentation License:: Copying and sharing this manual |
| 1013 | + |
| 1014 | +@end detailmenu |
| 1015 | +@end menu |
| 1016 | + |
| 1017 | + |
| 1018 | +@node Introduction |
| 1019 | +@chapter Introduction |
| 1020 | + |
| 1021 | +This manual is a work in progress: many sections make no attempt to explain |
| 1022 | +basic concepts in a way suitable for novices. Thus, if you are interested, |
| 1023 | +please get involved in improving this manual. The entire @sc{gnu} community |
| 1024 | +will benefit. |
| 1025 | + |
| 1026 | +@cindex @acronym{POSIX} |
| 1027 | +The @sc{gnu} utilities documented here are mostly compatible with the |
| 1028 | +@acronym{POSIX} standard. |
| 1029 | +@cindex bugs, reporting |
| 1030 | +Please report bugs to @email{bug-coreutils@@gnu.org}. Remember |
| 1031 | +to include the version number, machine architecture, input files, and |
| 1032 | +any other information needed to reproduce the bug: your input, what you |
| 1033 | +expected, what you got, and why it is wrong. Diffs are welcome, but |
| 1034 | +please include a description of the problem as well, since this is |
| 1035 | +sometimes difficult to infer. @xref{Bugs, , , gcc, Using and Porting GNU CC}. |
| 1036 | + |
| 1037 | +@cindex Berry, K. |
| 1038 | +@cindex Paterson, R. |
| 1039 | +@cindex Stallman, R. |
| 1040 | +@cindex Pinard, F. |
| 1041 | +@cindex MacKenzie, D. |
| 1042 | +@cindex Meyering, J. |
| 1043 | +@cindex Youmans, B. |
| 1044 | +This manual was originally derived from the Unix man pages in the |
| 1045 | +distributions, which were written by David MacKenzie and updated by Jim |
| 1046 | +Meyering. What you are reading now is the authoritative documentation |
| 1047 | +for these utilities; the man pages are no longer being maintained. The |
| 1048 | +original @command{fmt} man page was written by Ross Paterson. Fran@,{c}ois |
| 1049 | +Pinard did the initial conversion to Texinfo format. Karl Berry did the |
| 1050 | +indexing, some reorganization, and editing of the results. Brian |
| 1051 | +Youmans of the Free Software Foundation office staff combined the |
| 1052 | +manuals for textutils, fileutils, and sh-utils to produce the present |
| 1053 | +omnibus manual. Richard Stallman contributed his usual invaluable |
| 1054 | +insights to the overall process. |
| 1055 | + |
| 1056 | +@node Common options |
| 1057 | +@chapter Common options |
| 1058 | + |
| 1059 | +@macro optBackup |
| 1060 | +@item -b |
| 1061 | +@itemx @w{@kbd{--backup}[=@var{method}]} |
| 1062 | +@opindex -b |
| 1063 | +@opindex --backup |
| 1064 | +@vindex VERSION_CONTROL |
| 1065 | +@cindex backups, making |
| 1066 | +@xref{Backup options}. |
| 1067 | +Make a backup of each file that would otherwise be overwritten or removed. |
| 1068 | +@end macro |
| 1069 | + |
| 1070 | +@macro optBackupSuffix |
| 1071 | +@item -S @var{suffix} |
| 1072 | +@itemx --suffix=@var{suffix} |
| 1073 | +@opindex -S |
| 1074 | +@opindex --suffix |
| 1075 | +Append @var{suffix} to each backup file made with @option{-b}. |
| 1076 | +@xref{Backup options}. |
| 1077 | +@end macro |
| 1078 | + |
| 1079 | +@macro optTargetDirectory |
| 1080 | +@item -t @var{directory} |
| 1081 | +@itemx @w{@kbd{--target-directory}=@var{directory}} |
| 1082 | +@opindex -t |
| 1083 | +@opindex --target-directory |
| 1084 | +@cindex target directory |
| 1085 | +@cindex destination directory |
| 1086 | +Specify the destination @var{directory}. |
| 1087 | +@xref{Target directory}. |
| 1088 | +@end macro |
| 1089 | + |
| 1090 | +@macro optNoTargetDirectory |
| 1091 | +@item -T |
| 1092 | +@itemx --no-target-directory |
| 1093 | +@opindex -T |
| 1094 | +@opindex --no-target-directory |
| 1095 | +@cindex target directory |
| 1096 | +@cindex destination directory |
| 1097 | +Do not treat the last operand specially when it is a directory or a |
| 1098 | +symbolic link to a directory. @xref{Target directory}. |
| 1099 | +@end macro |
| 1100 | + |
| 1101 | +@macro optSi |
| 1102 | +@itemx --si |
| 1103 | +@opindex --si |
| 1104 | +@cindex SI output |
| 1105 | +Append an SI-style abbreviation to each size, such as @samp{M} for |
| 1106 | +megabytes. Powers of 1000 are used, not 1024; @samp{M} stands for |
| 1107 | +1,000,000 bytes. This option is equivalent to |
| 1108 | +@option{--block-size=si}. Use the @option{-h} or |
| 1109 | +@option{--human-readable} option if |
| 1110 | +you prefer powers of 1024. |
| 1111 | +@end macro |
| 1112 | + |
| 1113 | +@macro optHumanReadable |
| 1114 | +@item -h |
| 1115 | +@itemx --human-readable |
| 1116 | +@opindex -h |
| 1117 | +@opindex --human-readable |
| 1118 | +@cindex human-readable output |
| 1119 | +Append a size letter to each size, such as @samp{M} for mebibytes. |
| 1120 | +Powers of 1024 are used, not 1000; @samp{M} stands for 1,048,576 bytes. |
| 1121 | +This option is equivalent to @option{--block-size=human-readable}. |
| 1122 | +Use the @option{--si} option if you prefer powers of 1000. |
| 1123 | +@end macro |
| 1124 | + |
| 1125 | +@macro optStripTrailingSlashes |
| 1126 | +@itemx @w{@kbd{--strip-trailing-slashes}} |
| 1127 | +@opindex --strip-trailing-slashes |
| 1128 | +@cindex stripping trailing slashes |
| 1129 | +Remove any trailing slashes from each @var{source} argument. |
| 1130 | +@xref{Trailing slashes}. |
| 1131 | +@end macro |
| 1132 | + |
| 1133 | +@macro mayConflictWithShellBuiltIn{cmd} |
| 1134 | +@cindex conflicts with shell built-ins |
| 1135 | +@cindex built-in shell commands, conflicts with |
| 1136 | +Due to shell aliases and built-in @command{\cmd\} command, using an |
| 1137 | +unadorned @command{\cmd\} interactively or in a script may get you |
| 1138 | +different functionality than that described here. Invoke it via |
| 1139 | +@command{env} (i.e., @code{env \cmd\ @dots{}}) to avoid interference |
| 1140 | +from the shell. |
| 1141 | + |
| 1142 | +@end macro |
| 1143 | + |
| 1144 | +@macro multiplierSuffixes{varName} |
| 1145 | +@var{\varName\} may be, or may be an integer optionally followed by, |
| 1146 | +one of the following multiplicative suffixes: |
| 1147 | +@example |
| 1148 | +@samp{b} => 512 ("blocks") |
| 1149 | +@samp{KB} => 1000 (KiloBytes) |
| 1150 | +@samp{K} => 1024 (KibiBytes) |
| 1151 | +@samp{MB} => 1000*1000 (MegaBytes) |
| 1152 | +@samp{M} => 1024*1024 (MebiBytes) |
| 1153 | +@samp{GB} => 1000*1000*1000 (GigaBytes) |
| 1154 | +@samp{G} => 1024*1024*1024 (GibiBytes) |
| 1155 | +@end example |
| 1156 | +and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}. |
| 1157 | +@end macro |
| 1158 | + |
| 1159 | +@c FIXME: same as above, but no ``blocks'' line. |
| 1160 | +@macro multiplierSuffixesNoBlocks{varName} |
| 1161 | +@var{\varName\} may be, or may be an integer optionally followed by, |
| 1162 | +one of the following multiplicative suffixes: |
| 1163 | +@example |
| 1164 | +@samp{KB} => 1000 (KiloBytes) |
| 1165 | +@samp{K} => 1024 (KibiBytes) |
| 1166 | +@samp{MB} => 1000*1000 (MegaBytes) |
| 1167 | +@samp{M} => 1024*1024 (MebiBytes) |
| 1168 | +@samp{GB} => 1000*1000*1000 (GigaBytes) |
| 1169 | +@samp{G} => 1024*1024*1024 (GibiBytes) |
| 1170 | +@end example |
| 1171 | +and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}. |
| 1172 | +@end macro |
| 1173 | + |
| 1174 | +@cindex common options |
| 1175 | + |
| 1176 | +Certain options are available in all of these programs. Rather than |
| 1177 | +writing identical descriptions for each of the programs, they are |
| 1178 | +described here. (In fact, every @sc{gnu} program accepts (or should accept) |
| 1179 | +these options.) |
| 1180 | + |
| 1181 | +@vindex POSIXLY_CORRECT |
| 1182 | +Normally options and operands can appear in any order, and programs act |
| 1183 | +as if all the options appear before any operands. For example, |
| 1184 | +@samp{sort -r passwd -t :} acts like @samp{sort -r -t : passwd}, since |
| 1185 | +@samp{:} is an option-argument of @option{-t}. However, if the |
| 1186 | +@env{POSIXLY_CORRECT} environment variable is set, options must appear |
| 1187 | +before operands, unless otherwise specified for a particular command. |
| 1188 | + |
| 1189 | +A few programs can usefully have trailing operands with leading |
| 1190 | +@samp{-}. With such a program, options must precede operands even if |
| 1191 | +@env{POSIXLY_CORRECT} is not set, and this fact is noted in the |
| 1192 | +program description. For example, the @command{env} command's options |
| 1193 | +must appear before its operands, since in some cases the operands |
| 1194 | +specify a command that itself contains options. |
| 1195 | + |
| 1196 | +Most programs that accept long options recognize unambiguous |
| 1197 | +abbreviations of those options. For example, @samp{rmdir |
| 1198 | +--ignore-fail-on-non-empty} can be invoked as @samp{rmdir |
| 1199 | +--ignore-fail} or even @samp{rmdir --i}. Ambiguous options, such as |
| 1200 | +@samp{ls --h}, are identified as such. |
| 1201 | + |
| 1202 | +Some of these programs recognize the @option{--help} and @option{--version} |
| 1203 | +options only when one of them is the sole command line argument. For |
| 1204 | +these programs, abbreviations of the long options are not always recognized. |
| 1205 | + |
| 1206 | +@table @samp |
| 1207 | + |
| 1208 | +@item --help |
| 1209 | +@opindex --help |
| 1210 | +@cindex help, online |
| 1211 | +Print a usage message listing all available options, then exit successfully. |
| 1212 | + |
| 1213 | +@item --version |
| 1214 | +@opindex --version |
| 1215 | +@cindex version number, finding |
| 1216 | +Print the version number, then exit successfully. |
| 1217 | + |
| 1218 | +@item -- |
| 1219 | +@opindex -- |
| 1220 | +@cindex option delimiter |
| 1221 | +Delimit the option list. Later arguments, if any, are treated as |
| 1222 | +operands even if they begin with @samp{-}. For example, @samp{sort -- |
| 1223 | +-r} reads from the file named @file{-r}. |
| 1224 | + |
| 1225 | +@end table |
| 1226 | + |
| 1227 | +@cindex standard input |
| 1228 | +@cindex standard output |
| 1229 | +A single @samp{-} operand is not really an option, though it looks like one. It |
| 1230 | +stands for standard input, or for standard output if that is clear from |
| 1231 | +the context. For example, @samp{sort -} reads from standard input, |
| 1232 | +and is equivalent to plain @samp{sort}, and @samp{tee -} writes an |
| 1233 | +extra copy of its input to standard output. Unless otherwise |
| 1234 | +specified, @samp{-} can appear as any operand that requires a file |
| 1235 | +name. |
| 1236 | + |
| 1237 | +@menu |
| 1238 | +* Exit status:: Indicating program success or failure. |
| 1239 | +* Backup options:: -b -S, in some programs. |
| 1240 | +* Block size:: BLOCK_SIZE and --block-size, in some programs. |
| 1241 | +* Signal specifications:: Specifying signals using the --signal option. |
| 1242 | +* Disambiguating names and IDs:: chgrp and chown owner and group syntax |
| 1243 | +* Random sources:: --random-source, in some programs. |
| 1244 | +* Target directory:: Specifying a target directory, in some programs. |
| 1245 | +* Trailing slashes:: --strip-trailing-slashes, in some programs. |
| 1246 | +* Traversing symlinks:: -H, -L, or -P, in some programs. |
| 1247 | +* Treating / specially:: --preserve-root and --no-preserve-root. |
| 1248 | +* Special built-in utilities:: @command{break}, @command{:}, @command{eval}, @dots{} |
| 1249 | +* Standards conformance:: Conformance to the @acronym{POSIX} standard. |
| 1250 | +@end menu |
| 1251 | + |
| 1252 | + |
| 1253 | +@node Exit status |
| 1254 | +@section Exit status |
| 1255 | + |
| 1256 | +@macro exitstatus |
| 1257 | +An exit status of zero indicates success, |
| 1258 | +and a nonzero value indicates failure. |
| 1259 | +@end macro |
| 1260 | + |
| 1261 | +Nearly every command invocation yields an integral @dfn{exit status} |
| 1262 | +that can be used to change how other commands work. |
| 1263 | +For the vast majority of commands, an exit status of zero indicates |
| 1264 | +success. Failure is indicated by a nonzero value---typically |
| 1265 | +@samp{1}, though it may differ on unusual platforms as @acronym{POSIX} |
| 1266 | +requires only that it be nonzero. |
| 1267 | + |
| 1268 | +However, some of the programs documented here do produce |
| 1269 | +other exit status values and a few associate different |
| 1270 | +meanings with the values @samp{0} and @samp{1}. |
| 1271 | +Here are some of the exceptions: |
| 1272 | +@command{chroot}, @command{env}, @command{expr}, @command{nice}, |
| 1273 | +@command{nohup}, @command{printenv}, @command{sort}, @command{stdbuf}, |
| 1274 | +@command{su}, @command{test}, @command{timeout}, @command{tty}. |
| 1275 | + |
| 1276 | + |
| 1277 | +@node Backup options |
| 1278 | +@section Backup options |
| 1279 | + |
| 1280 | +@cindex backup options |
| 1281 | + |
| 1282 | +Some @sc{gnu} programs (at least @command{cp}, @command{install}, |
| 1283 | +@command{ln}, and @command{mv}) optionally make backups of files |
| 1284 | +before writing new versions. |
| 1285 | +These options control the details of these backups. The options are also |
| 1286 | +briefly mentioned in the descriptions of the particular programs. |
| 1287 | + |
| 1288 | +@table @samp |
| 1289 | + |
| 1290 | +@item -b |
| 1291 | +@itemx @w{@kbd{--backup}[=@var{method}]} |
| 1292 | +@opindex -b |
| 1293 | +@opindex --backup |
| 1294 | +@vindex VERSION_CONTROL |
| 1295 | +@cindex backups, making |
| 1296 | +Make a backup of each file that would otherwise be overwritten or removed. |
| 1297 | +Without this option, the original versions are destroyed. |
| 1298 | +Use @var{method} to determine the type of backups to make. |
| 1299 | +When this option is used but @var{method} is not specified, |
| 1300 | +then the value of the @env{VERSION_CONTROL} |
| 1301 | +environment variable is used. And if @env{VERSION_CONTROL} is not set, |
| 1302 | +the default backup type is @samp{existing}. |
| 1303 | + |
| 1304 | +Note that the short form of this option, @option{-b} does not accept any |
| 1305 | +argument. Using @option{-b} is equivalent to using @option{--backup=existing}. |
| 1306 | + |
| 1307 | +@vindex version-control @r{Emacs variable} |
| 1308 | +This option corresponds to the Emacs variable @samp{version-control}; |
| 1309 | +the values for @var{method} are the same as those used in Emacs. |
| 1310 | +This option also accepts more descriptive names. |
| 1311 | +The valid @var{method}s are (unique abbreviations are accepted): |
| 1312 | + |
| 1313 | +@table @samp |
| 1314 | +@item none |
| 1315 | +@itemx off |
| 1316 | +@opindex none @r{backup method} |
| 1317 | +Never make backups. |
| 1318 | + |
| 1319 | +@item numbered |
| 1320 | +@itemx t |
| 1321 | +@opindex numbered @r{backup method} |
| 1322 | +Always make numbered backups. |
| 1323 | + |
| 1324 | +@item existing |
| 1325 | +@itemx nil |
| 1326 | +@opindex existing @r{backup method} |
| 1327 | +Make numbered backups of files that already have them, simple backups |
| 1328 | +of the others. |
| 1329 | + |
| 1330 | +@item simple |
| 1331 | +@itemx never |
| 1332 | +@opindex simple @r{backup method} |
| 1333 | +Always make simple backups. Please note @samp{never} is not to be |
| 1334 | +confused with @samp{none}. |
| 1335 | + |
| 1336 | +@end table |
| 1337 | + |
| 1338 | +@item -S @var{suffix} |
| 1339 | +@itemx --suffix=@var{suffix} |
| 1340 | +@opindex -S |
| 1341 | +@opindex --suffix |
| 1342 | +@cindex backup suffix |
| 1343 | +@vindex SIMPLE_BACKUP_SUFFIX |
| 1344 | +Append @var{suffix} to each backup file made with @option{-b}. If this |
| 1345 | +option is not specified, the value of the @env{SIMPLE_BACKUP_SUFFIX} |
| 1346 | +environment variable is used. And if @env{SIMPLE_BACKUP_SUFFIX} is not |
| 1347 | +set, the default is @samp{~}, just as in Emacs. |
| 1348 | + |
| 1349 | +@end table |
| 1350 | + |
| 1351 | +@node Block size |
| 1352 | +@section Block size |
| 1353 | + |
| 1354 | +@cindex block size |
| 1355 | + |
| 1356 | +Some @sc{gnu} programs (at least @command{df}, @command{du}, and |
| 1357 | +@command{ls}) display sizes in ``blocks''. You can adjust the block size |
| 1358 | +and method of display to make sizes easier to read. The block size |
| 1359 | +used for display is independent of any file system block size. |
| 1360 | +Fractional block counts are rounded up to the nearest integer. |
| 1361 | + |
| 1362 | +@opindex --block-size=@var{size} |
| 1363 | +@vindex BLOCKSIZE |
| 1364 | +@vindex BLOCK_SIZE |
| 1365 | +@vindex DF_BLOCK_SIZE |
| 1366 | +@vindex DU_BLOCK_SIZE |
| 1367 | +@vindex LS_BLOCK_SIZE |
| 1368 | +@vindex POSIXLY_CORRECT@r{, and block size} |
| 1369 | + |
| 1370 | +The default block size is chosen by examining the following environment |
| 1371 | +variables in turn; the first one that is set determines the block size. |
| 1372 | + |
| 1373 | +@table @code |
| 1374 | + |
| 1375 | +@item DF_BLOCK_SIZE |
| 1376 | +This specifies the default block size for the @command{df} command. |
| 1377 | +Similarly, @env{DU_BLOCK_SIZE} specifies the default for @command{du} and |
| 1378 | +@env{LS_BLOCK_SIZE} for @command{ls}. |
| 1379 | + |
| 1380 | +@item BLOCK_SIZE |
| 1381 | +This specifies the default block size for all three commands, if the |
| 1382 | +above command-specific environment variables are not set. |
| 1383 | + |
| 1384 | +@item BLOCKSIZE |
| 1385 | +This specifies the default block size for all values that are normally |
| 1386 | +printed as blocks, if neither @env{BLOCK_SIZE} nor the above |
| 1387 | +command-specific environment variables are set. Unlike the other |
| 1388 | +environment variables, @env{BLOCKSIZE} does not affect values that are |
| 1389 | +normally printed as byte counts, e.g., the file sizes contained in |
| 1390 | +@code{ls -l} output. |
| 1391 | + |
| 1392 | +@item POSIXLY_CORRECT |
| 1393 | +If neither @env{@var{command}_BLOCK_SIZE}, nor @env{BLOCK_SIZE}, nor |
| 1394 | +@env{BLOCKSIZE} is set, but this variable is set, the block size |
| 1395 | +defaults to 512. |
| 1396 | + |
| 1397 | +@end table |
| 1398 | + |
| 1399 | +If none of the above environment variables are set, the block size |
| 1400 | +currently defaults to 1024 bytes in most contexts, but this number may |
| 1401 | +change in the future. For @command{ls} file sizes, the block size |
| 1402 | +defaults to 1 byte. |
| 1403 | + |
| 1404 | +@cindex human-readable output |
| 1405 | +@cindex SI output |
| 1406 | + |
| 1407 | +A block size specification can be a positive integer specifying the number |
| 1408 | +of bytes per block, or it can be @code{human-readable} or @code{si} to |
| 1409 | +select a human-readable format. Integers may be followed by suffixes |
| 1410 | +that are upward compatible with the |
| 1411 | +@uref{http://www.bipm.fr/enus/3_SI/si-prefixes.html, SI prefixes} |
| 1412 | +for decimal multiples and with the |
| 1413 | +@uref{http://physics.nist.gov/cuu/Units/binary.html, IEC 60027-2 |
| 1414 | +prefixes for binary multiples}. |
| 1415 | + |
| 1416 | +With human-readable formats, output sizes are followed by a size letter |
| 1417 | +such as @samp{M} for megabytes. @code{BLOCK_SIZE=human-readable} uses |
| 1418 | +powers of 1024; @samp{M} stands for 1,048,576 bytes. |
| 1419 | +@code{BLOCK_SIZE=si} is similar, but uses powers of 1000 and appends |
| 1420 | +@samp{B}; @samp{MB} stands for 1,000,000 bytes. |
| 1421 | + |
| 1422 | +@vindex LC_NUMERIC |
| 1423 | +A block size specification preceded by @samp{'} causes output sizes to |
| 1424 | +be displayed with thousands separators. The @env{LC_NUMERIC} locale |
| 1425 | +specifies the thousands separator and grouping. For example, in an |
| 1426 | +American English locale, @samp{--block-size="'1kB"} would cause a size |
| 1427 | +of 1234000 bytes to be displayed as @samp{1,234}. In the default C |
| 1428 | +locale, there is no thousands separator so a leading @samp{'} has no |
| 1429 | +effect. |
| 1430 | + |
| 1431 | +An integer block size can be followed by a suffix to specify a |
| 1432 | +multiple of that size. A bare size letter, |
| 1433 | +or one followed by @samp{iB}, specifies |
| 1434 | +a multiple using powers of 1024. A size letter followed by @samp{B} |
| 1435 | +specifies powers of 1000 instead. For example, @samp{1M} and |
| 1436 | +@samp{1MiB} are equivalent to @samp{1048576}, whereas @samp{1MB} is |
| 1437 | +equivalent to @samp{1000000}. |
| 1438 | + |
| 1439 | +A plain suffix without a preceding integer acts as if @samp{1} were |
| 1440 | +prepended, except that it causes a size indication to be appended to |
| 1441 | +the output. For example, @samp{--block-size="kB"} displays 3000 as |
| 1442 | +@samp{3kB}. |
| 1443 | + |
| 1444 | +The following suffixes are defined. Large sizes like @code{1Y} |
| 1445 | +may be rejected by your computer due to limitations of its arithmetic. |
| 1446 | + |
| 1447 | +@table @samp |
| 1448 | +@item kB |
| 1449 | +@cindex kilobyte, definition of |
| 1450 | +kilobyte: @math{10^3 = 1000}. |
| 1451 | +@item k |
| 1452 | +@itemx K |
| 1453 | +@itemx KiB |
| 1454 | +@cindex kibibyte, definition of |
| 1455 | +kibibyte: @math{2^{10} = 1024}. @samp{K} is special: the SI prefix is |
| 1456 | +@samp{k} and the IEC 60027-2 prefix is @samp{Ki}, but tradition and |
| 1457 | +@acronym{POSIX} use @samp{k} to mean @samp{KiB}. |
| 1458 | +@item MB |
| 1459 | +@cindex megabyte, definition of |
| 1460 | +megabyte: @math{10^6 = 1,000,000}. |
| 1461 | +@item M |
| 1462 | +@itemx MiB |
| 1463 | +@cindex mebibyte, definition of |
| 1464 | +mebibyte: @math{2^{20} = 1,048,576}. |
| 1465 | +@item GB |
| 1466 | +@cindex gigabyte, definition of |
| 1467 | +gigabyte: @math{10^9 = 1,000,000,000}. |
| 1468 | +@item G |
| 1469 | +@itemx GiB |
| 1470 | +@cindex gibibyte, definition of |
| 1471 | +gibibyte: @math{2^{30} = 1,073,741,824}. |
| 1472 | +@item TB |
| 1473 | +@cindex terabyte, definition of |
| 1474 | +terabyte: @math{10^{12} = 1,000,000,000,000}. |
| 1475 | +@item T |
| 1476 | +@itemx TiB |
| 1477 | +@cindex tebibyte, definition of |
| 1478 | +tebibyte: @math{2^{40} = 1,099,511,627,776}. |
| 1479 | +@item PB |
| 1480 | +@cindex petabyte, definition of |
| 1481 | +petabyte: @math{10^{15} = 1,000,000,000,000,000}. |
| 1482 | +@item P |
| 1483 | +@itemx PiB |
| 1484 | +@cindex pebibyte, definition of |
| 1485 | +pebibyte: @math{2^{50} = 1,125,899,906,842,624}. |
| 1486 | +@item EB |
| 1487 | +@cindex exabyte, definition of |
| 1488 | +exabyte: @math{10^{18} = 1,000,000,000,000,000,000}. |
| 1489 | +@item E |
| 1490 | +@itemx EiB |
| 1491 | +@cindex exbibyte, definition of |
| 1492 | +exbibyte: @math{2^{60} = 1,152,921,504,606,846,976}. |
| 1493 | +@item ZB |
| 1494 | +@cindex zettabyte, definition of |
| 1495 | +zettabyte: @math{10^{21} = 1,000,000,000,000,000,000,000} |
| 1496 | +@item Z |
| 1497 | +@itemx ZiB |
| 1498 | +@math{2^{70} = 1,180,591,620,717,411,303,424}. |
| 1499 | +(@samp{Zi} is a @acronym{GNU} extension to IEC 60027-2.) |
| 1500 | +@item YB |
| 1501 | +@cindex yottabyte, definition of |
| 1502 | +yottabyte: @math{10^{24} = 1,000,000,000,000,000,000,000,000}. |
| 1503 | +@item Y |
| 1504 | +@itemx YiB |
| 1505 | +@math{2^{80} = 1,208,925,819,614,629,174,706,176}. |
| 1506 | +(@samp{Yi} is a @acronym{GNU} extension to IEC 60027-2.) |
| 1507 | +@end table |
| 1508 | + |
| 1509 | +@opindex -k |
| 1510 | +@opindex -h |
| 1511 | +@opindex --block-size |
| 1512 | +@opindex --human-readable |
| 1513 | +@opindex --si |
| 1514 | + |
| 1515 | +Block size defaults can be overridden by an explicit |
| 1516 | +@option{--block-size=@var{size}} option. The @option{-k} |
| 1517 | +option is equivalent to @option{--block-size=1K}, which |
| 1518 | +is the default unless the @env{POSIXLY_CORRECT} environment variable is |
| 1519 | +set. The @option{-h} or @option{--human-readable} option is equivalent to |
| 1520 | +@option{--block-size=human-readable}. The @option{--si} option is |
| 1521 | +equivalent to @option{--block-size=si}. |
| 1522 | + |
| 1523 | +@node Signal specifications |
| 1524 | +@section Signal specifications |
| 1525 | +@cindex signals, specifying |
| 1526 | + |
| 1527 | +A @var{signal} may be a signal name like @samp{HUP}, or a signal |
| 1528 | +number like @samp{1}, or an exit status of a process terminated by the |
| 1529 | +signal. A signal name can be given in canonical form or prefixed by |
| 1530 | +@samp{SIG}. The case of the letters is ignored. The following signal names |
| 1531 | +and numbers are supported on all @acronym{POSIX} compliant systems: |
| 1532 | + |
| 1533 | +@table @samp |
| 1534 | +@item HUP |
| 1535 | +1. Hangup. |
| 1536 | +@item INT |
| 1537 | +2. Terminal interrupt. |
| 1538 | +@item QUIT |
| 1539 | +3. Terminal quit. |
| 1540 | +@item ABRT |
| 1541 | +6. Process abort. |
| 1542 | +@item KILL |
| 1543 | +9. Kill (cannot be caught or ignored). |
| 1544 | +@item ALRM |
| 1545 | +14. Alarm Clock. |
| 1546 | +@item TERM |
| 1547 | +15. Termination. |
| 1548 | +@end table |
| 1549 | + |
| 1550 | +@noindent |
| 1551 | +Other supported signal names have system-dependent corresponding |
| 1552 | +numbers. All systems conforming to @acronym{POSIX} 1003.1-2001 also |
| 1553 | +support the following signals: |
| 1554 | + |
| 1555 | +@table @samp |
| 1556 | +@item BUS |
| 1557 | +Access to an undefined portion of a memory object. |
| 1558 | +@item CHLD |
| 1559 | +Child process terminated, stopped, or continued. |
| 1560 | +@item CONT |
| 1561 | +Continue executing, if stopped. |
| 1562 | +@item FPE |
| 1563 | +Erroneous arithmetic operation. |
| 1564 | +@item ILL |
| 1565 | +Illegal Instruction. |
| 1566 | +@item PIPE |
| 1567 | +Write on a pipe with no one to read it. |
| 1568 | +@item SEGV |
| 1569 | +Invalid memory reference. |
| 1570 | +@item STOP |
| 1571 | +Stop executing (cannot be caught or ignored). |
| 1572 | +@item TSTP |
| 1573 | +Terminal stop. |
| 1574 | +@item TTIN |
| 1575 | +Background process attempting read. |
| 1576 | +@item TTOU |
| 1577 | +Background process attempting write. |
| 1578 | +@item URG |
| 1579 | +High bandwidth data is available at a socket. |
| 1580 | +@item USR1 |
| 1581 | +User-defined signal 1. |
| 1582 | +@item USR2 |
| 1583 | +User-defined signal 2. |
| 1584 | +@end table |
| 1585 | + |
| 1586 | +@noindent |
| 1587 | +@acronym{POSIX} 1003.1-2001 systems that support the @acronym{XSI} extension |
| 1588 | +also support the following signals: |
| 1589 | + |
| 1590 | +@table @samp |
| 1591 | +@item POLL |
| 1592 | +Pollable event. |
| 1593 | +@item PROF |
| 1594 | +Profiling timer expired. |
| 1595 | +@item SYS |
| 1596 | +Bad system call. |
| 1597 | +@item TRAP |
| 1598 | +Trace/breakpoint trap. |
| 1599 | +@item VTALRM |
| 1600 | +Virtual timer expired. |
| 1601 | +@item XCPU |
| 1602 | +CPU time limit exceeded. |
| 1603 | +@item XFSZ |
| 1604 | +File size limit exceeded. |
| 1605 | +@end table |
| 1606 | + |
| 1607 | +@noindent |
| 1608 | +@acronym{POSIX} 1003.1-2001 systems that support the @acronym{XRT} extension |
| 1609 | +also support at least eight real-time signals called @samp{RTMIN}, |
| 1610 | +@samp{RTMIN+1}, @dots{}, @samp{RTMAX-1}, @samp{RTMAX}. |
| 1611 | + |
| 1612 | +@node Disambiguating names and IDs |
| 1613 | +@section chown and chgrp: Disambiguating user names and IDs |
| 1614 | +@cindex user names, disambiguating |
| 1615 | +@cindex user IDs, disambiguating |
| 1616 | +@cindex group names, disambiguating |
| 1617 | +@cindex group IDs, disambiguating |
| 1618 | +@cindex disambiguating group names and IDs |
| 1619 | + |
| 1620 | +Since the @var{owner} and @var{group} arguments to @command{chown} and |
| 1621 | +@command{chgrp} may be specified as names or numeric IDs, there is an |
| 1622 | +apparent ambiguity. |
| 1623 | +What if a user or group @emph{name} is a string of digits? |
| 1624 | +@footnote{Using a number as a user name is common in some environments.} |
| 1625 | +Should the command interpret it as a user name or as an ID? |
| 1626 | +@acronym{POSIX} requires that @command{chown} and @command{chgrp} |
| 1627 | +first attempt to resolve the specified string as a name, and |
| 1628 | +only once that fails, then try to interpret it as an ID. |
| 1629 | +This is troublesome when you want to specify a numeric ID, say 42, |
| 1630 | +and it must work even in a pathological situation where |
| 1631 | +@samp{42} is a user name that maps to some other user ID, say 1000. |
| 1632 | +Simply invoking @code{chown 42 F}, will set @file{F}s owner ID to |
| 1633 | +1000---not what you intended. |
| 1634 | + |
| 1635 | +GNU @command{chown} and @command{chgrp} provide a way to work around this, |
| 1636 | +that at the same time may result in a significant performance improvement |
| 1637 | +by eliminating a database look-up. |
| 1638 | +Simply precede each numeric user ID and/or group ID with a @samp{+}, |
| 1639 | +in order to force its interpretation as an integer: |
| 1640 | + |
| 1641 | +@example |
| 1642 | +chown +42 F |
| 1643 | +chgrp +$numeric_group_id another-file |
| 1644 | +chown +0:+0 / |
| 1645 | +@end example |
| 1646 | + |
| 1647 | +GNU @command{chown} and @command{chgrp} |
| 1648 | +skip the name look-up process for each @samp{+}-prefixed string, |
| 1649 | +because a string containing @samp{+} is never a valid user or group name. |
| 1650 | +This syntax is accepted on most common Unix systems, but not on Solaris 10. |
| 1651 | + |
| 1652 | +@node Random sources |
| 1653 | +@section Sources of random data |
| 1654 | + |
| 1655 | +@cindex random sources |
| 1656 | + |
| 1657 | +The @command{shuf}, @command{shred}, and @command{sort} commands |
| 1658 | +sometimes need random data to do their work. For example, @samp{sort |
| 1659 | +-R} must choose a hash function at random, and it needs random data to |
| 1660 | +make this selection. |
| 1661 | + |
| 1662 | +By default these commands use an internal pseudorandom generator |
| 1663 | +initialized by a small amount of entropy, but can be directed to use |
| 1664 | +an external source with the @option{--random-source=@var{file}} option. |
| 1665 | +An error is reported if @var{file} does not contain enough bytes. |
| 1666 | + |
| 1667 | +For example, the device file @file{/dev/urandom} could be used as the |
| 1668 | +source of random data. Typically, this device gathers environmental |
| 1669 | +noise from device drivers and other sources into an entropy pool, and |
| 1670 | +uses the pool to generate random bits. If the pool is short of data, |
| 1671 | +the device reuses the internal pool to produce more bits, using a |
| 1672 | +cryptographically secure pseudorandom number generator. But be aware |
| 1673 | +that this device is not designed for bulk random data generation |
| 1674 | +and is relatively slow. |
| 1675 | + |
| 1676 | +@file{/dev/urandom} suffices for most practical uses, but applications |
| 1677 | +requiring high-value or long-term protection of private data may |
| 1678 | +require an alternate data source like @file{/dev/random} or |
| 1679 | +@file{/dev/arandom}. The set of available sources depends on your |
| 1680 | +operating system. |
| 1681 | + |
| 1682 | +To reproduce the results of an earlier invocation of a command, you |
| 1683 | +can save some random data into a file and then use that file as the |
| 1684 | +random source in earlier and later invocations of the command. |
| 1685 | + |
| 1686 | +@node Target directory |
| 1687 | +@section Target directory |
| 1688 | + |
| 1689 | +@cindex target directory |
| 1690 | + |
| 1691 | +The @command{cp}, @command{install}, @command{ln}, and @command{mv} |
| 1692 | +commands normally treat the last operand specially when it is a |
| 1693 | +directory or a symbolic link to a directory. For example, @samp{cp |
| 1694 | +source dest} is equivalent to @samp{cp source dest/source} if |
| 1695 | +@file{dest} is a directory. Sometimes this behavior is not exactly |
| 1696 | +what is wanted, so these commands support the following options to |
| 1697 | +allow more fine-grained control: |
| 1698 | + |
| 1699 | +@table @samp |
| 1700 | + |
| 1701 | +@item -T |
| 1702 | +@itemx --no-target-directory |
| 1703 | +@opindex --no-target-directory |
| 1704 | +@cindex target directory |
| 1705 | +@cindex destination directory |
| 1706 | +Do not treat the last operand specially when it is a directory or a |
| 1707 | +symbolic link to a directory. This can help avoid race conditions in |
| 1708 | +programs that operate in a shared area. For example, when the command |
| 1709 | +@samp{mv /tmp/source /tmp/dest} succeeds, there is no guarantee that |
| 1710 | +@file{/tmp/source} was renamed to @file{/tmp/dest}: it could have been |
| 1711 | +renamed to @file{/tmp/dest/source} instead, if some other process |
| 1712 | +created @file{/tmp/dest} as a directory. However, if @file{mv |
| 1713 | +-T /tmp/source /tmp/dest} succeeds, there is no |
| 1714 | +question that @file{/tmp/source} was renamed to @file{/tmp/dest}. |
| 1715 | + |
| 1716 | +In the opposite situation, where you want the last operand to be |
| 1717 | +treated as a directory and want a diagnostic otherwise, you can use |
| 1718 | +the @option{--target-directory} (@option{-t}) option. |
| 1719 | + |
| 1720 | +@item -t @var{directory} |
| 1721 | +@itemx @w{@kbd{--target-directory}=@var{directory}} |
| 1722 | +@opindex --target-directory |
| 1723 | +@cindex target directory |
| 1724 | +@cindex destination directory |
| 1725 | +Use @var{directory} as the directory component of each destination |
| 1726 | +file name. |
| 1727 | + |
| 1728 | +The interface for most programs is that after processing options and a |
| 1729 | +finite (possibly zero) number of fixed-position arguments, the remaining |
| 1730 | +argument list is either expected to be empty, or is a list of items |
| 1731 | +(usually files) that will all be handled identically. The @command{xargs} |
| 1732 | +program is designed to work well with this convention. |
| 1733 | + |
| 1734 | +The commands in the @command{mv}-family are unusual in that they take |
| 1735 | +a variable number of arguments with a special case at the @emph{end} |
| 1736 | +(namely, the target directory). This makes it nontrivial to perform some |
| 1737 | +operations, e.g., ``move all files from here to ../d/'', because |
| 1738 | +@code{mv * ../d/} might exhaust the argument space, and @code{ls | xargs ...} |
| 1739 | +doesn't have a clean way to specify an extra final argument for each |
| 1740 | +invocation of the subject command. (It can be done by going through a |
| 1741 | +shell command, but that requires more human labor and brain power than |
| 1742 | +it should.) |
| 1743 | + |
| 1744 | +The @w{@kbd{--target-directory}} (@option{-t}) option allows the @command{cp}, |
| 1745 | +@command{install}, @command{ln}, and @command{mv} programs to be used |
| 1746 | +conveniently with @command{xargs}. For example, you can move the files |
| 1747 | +from the current directory to a sibling directory, @code{d} like this: |
| 1748 | + |
| 1749 | +@smallexample |
| 1750 | +ls | xargs mv -t ../d -- |
| 1751 | +@end smallexample |
| 1752 | + |
| 1753 | +However, this doesn't move files whose names begin with @samp{.}. |
| 1754 | +If you use the @sc{gnu} @command{find} program, you can move those |
| 1755 | +files too, with this command: |
| 1756 | + |
| 1757 | +@example |
| 1758 | +find . -mindepth 1 -maxdepth 1 \ |
| 1759 | + | xargs mv -t ../d |
| 1760 | +@end example |
| 1761 | + |
| 1762 | +But both of the above approaches fail if there are no files in the |
| 1763 | +current directory, or if any file has a name containing a blank or |
| 1764 | +some other special characters. |
| 1765 | +The following example removes those limitations and requires both |
| 1766 | +@sc{gnu} @command{find} and @sc{gnu} @command{xargs}: |
| 1767 | + |
| 1768 | +@example |
| 1769 | +find . -mindepth 1 -maxdepth 1 -print0 \ |
| 1770 | + | xargs --null --no-run-if-empty \ |
| 1771 | + mv -t ../d |
| 1772 | +@end example |
| 1773 | + |
| 1774 | +@end table |
| 1775 | + |
| 1776 | +@noindent |
| 1777 | +The @option{--target-directory} (@option{-t}) and |
| 1778 | +@option{--no-target-directory} (@option{-T}) |
| 1779 | +options cannot be combined. |
| 1780 | + |
| 1781 | +@node Trailing slashes |
| 1782 | +@section Trailing slashes |
| 1783 | + |
| 1784 | +@cindex trailing slashes |
| 1785 | + |
| 1786 | +Some @sc{gnu} programs (at least @command{cp} and @command{mv}) allow you to |
| 1787 | +remove any trailing slashes from each @var{source} argument before |
| 1788 | +operating on it. The @w{@kbd{--strip-trailing-slashes}} option enables |
| 1789 | +this behavior. |
| 1790 | + |
| 1791 | +This is useful when a @var{source} argument may have a trailing slash and |
| 1792 | +@c FIXME: mv's behavior in this case is system-dependent |
| 1793 | +specify a symbolic link to a directory. This scenario is in fact rather |
| 1794 | +common because some shells can automatically append a trailing slash when |
| 1795 | +performing file name completion on such symbolic links. Without this |
| 1796 | +option, @command{mv}, for example, (via the system's rename function) must |
| 1797 | +interpret a trailing slash as a request to dereference the symbolic link |
| 1798 | +and so must rename the indirectly referenced @emph{directory} and not |
| 1799 | +the symbolic link. Although it may seem surprising that such behavior |
| 1800 | +be the default, it is required by @acronym{POSIX} and is consistent with |
| 1801 | +other parts of that standard. |
| 1802 | + |
| 1803 | +@node Traversing symlinks |
| 1804 | +@section Traversing symlinks |
| 1805 | + |
| 1806 | +@cindex symbolic link to directory, controlling traversal of |
| 1807 | + |
| 1808 | +The following options modify how @command{chown} and @command{chgrp} |
| 1809 | +@c FIXME: note that `du' has these options, too, but they have slightly |
| 1810 | +@c different meaning. |
| 1811 | +traverse a hierarchy when the @option{--recursive} (@option{-R}) |
| 1812 | +option is also specified. |
| 1813 | +If more than one of the following options is specified, only the final |
| 1814 | +one takes effect. |
| 1815 | +These options specify whether processing a symbolic link to a directory |
| 1816 | +entails operating on just the symbolic link or on all files in the |
| 1817 | +hierarchy rooted at that directory. |
| 1818 | + |
| 1819 | +These options are independent of @option{--dereference} and |
| 1820 | +@option{--no-dereference} (@option{-h}), which control whether to modify |
| 1821 | +a symlink or its referent. |
| 1822 | + |
| 1823 | +@table @samp |
| 1824 | + |
| 1825 | +@macro choptH |
| 1826 | +@item -H |
| 1827 | +@opindex -H |
| 1828 | +@cindex symbolic link to directory, traverse each that is specified on the command line |
| 1829 | +If @option{--recursive} (@option{-R}) is specified and |
| 1830 | +a command line argument is a symbolic link to a directory, traverse it. |
| 1831 | +@end macro |
| 1832 | +@choptH |
| 1833 | + |
| 1834 | +@macro choptL |
| 1835 | +@item -L |
| 1836 | +@opindex -L |
| 1837 | +@cindex symbolic link to directory, traverse each that is encountered |
| 1838 | +In a recursive traversal, traverse every symbolic link to a directory |
| 1839 | +that is encountered. |
| 1840 | +@end macro |
| 1841 | +@choptL |
| 1842 | + |
| 1843 | +@macro choptP |
| 1844 | +@item -P |
| 1845 | +@opindex -P |
| 1846 | +@cindex symbolic link to directory, never traverse |
| 1847 | +Do not traverse any symbolic links. |
| 1848 | +This is the default if none of @option{-H}, @option{-L}, |
| 1849 | +or @option{-P} is specified. |
| 1850 | +@end macro |
| 1851 | +@choptP |
| 1852 | + |
| 1853 | +@end table |
| 1854 | + |
| 1855 | + |
| 1856 | +@node Treating / specially |
| 1857 | +@section Treating @file{/} specially |
| 1858 | + |
| 1859 | +Certain commands can operate destructively on entire hierarchies. |
| 1860 | +For example, if a user with appropriate privileges mistakenly runs |
| 1861 | +@samp{rm -rf / tmp/junk}, that may remove |
| 1862 | +all files on the entire system. Since there are so few |
| 1863 | +legitimate uses for such a command, |
| 1864 | +@sc{gnu} @command{rm} normally declines to operate on any directory |
| 1865 | +that resolves to @file{/}. If you really want to try to remove all |
| 1866 | +the files on your system, you can use the @option{--no-preserve-root} |
| 1867 | +option, but the default behavior, specified by the |
| 1868 | +@option{--preserve-option}, is safer for most purposes. |
| 1869 | + |
| 1870 | +The commands @command{chgrp}, @command{chmod} and @command{chown} |
| 1871 | +can also operate destructively on entire hierarchies, so they too |
| 1872 | +support these options. Although, unlike @command{rm}, they don't |
| 1873 | +actually unlink files, these commands are arguably more dangerous |
| 1874 | +when operating recursively on @file{/}, since they often work much |
| 1875 | +more quickly, and hence damage more files before an alert user can |
| 1876 | +interrupt them. Tradition and @acronym{POSIX} require these commands |
| 1877 | +to operate recursively on @file{/}, so they default to |
| 1878 | +@option{--no-preserve-root}, but using the @option{--preserve-root} |
| 1879 | +option makes them safer for most purposes. For convenience you can |
| 1880 | +specify @option{--preserve-root} in an alias or in a shell function. |
| 1881 | + |
| 1882 | +Note that the @option{--preserve-root} option also ensures |
| 1883 | +that @command{chgrp} and @command{chown} do not modify @file{/} |
| 1884 | +even when dereferencing a symlink pointing to @file{/}. |
| 1885 | + |
| 1886 | +@node Special built-in utilities |
| 1887 | +@section Special built-in utilities |
| 1888 | + |
| 1889 | +Some programs like @command{nice} can invoke other programs; for |
| 1890 | +example, the command @samp{nice cat file} invokes the program |
| 1891 | +@command{cat} by executing the command @samp{cat file}. However, |
| 1892 | +@dfn{special built-in utilities} like @command{exit} cannot be invoked |
| 1893 | +this way. For example, the command @samp{nice exit} does not have a |
| 1894 | +well-defined behavior: it may generate an error message instead of |
| 1895 | +exiting. |
| 1896 | + |
| 1897 | +Here is a list of the special built-in utilities that are standardized |
| 1898 | +by @acronym{POSIX} 1003.1-2004. |
| 1899 | + |
| 1900 | +@quotation |
| 1901 | +@t{.@: : break continue eval exec exit export readonly |
| 1902 | +return set shift times trap unset} |
| 1903 | +@end quotation |
| 1904 | + |
| 1905 | +For example, because @samp{.}, @samp{:}, and @samp{exec} are special, |
| 1906 | +the commands @samp{nice . foo.sh}, @samp{nice :}, and @samp{nice exec |
| 1907 | +pwd} do not work as you might expect. |
| 1908 | + |
| 1909 | +Many shells extend this list. For example, Bash has several extra |
| 1910 | +special built-in utilities like @command{history}, and |
| 1911 | +@command{suspend}, and with Bash the command @samp{nice suspend} |
| 1912 | +generates an error message instead of suspending. |
| 1913 | + |
| 1914 | +@node Standards conformance |
| 1915 | +@section Standards conformance |
| 1916 | + |
| 1917 | +@vindex POSIXLY_CORRECT |
| 1918 | +In a few cases, the @sc{gnu} utilities' default behavior is |
| 1919 | +incompatible with the @acronym{POSIX} standard. To suppress these |
| 1920 | +incompatibilities, define the @env{POSIXLY_CORRECT} environment |
| 1921 | +variable. Unless you are checking for @acronym{POSIX} conformance, you |
| 1922 | +probably do not need to define @env{POSIXLY_CORRECT}. |
| 1923 | + |
| 1924 | +Newer versions of @acronym{POSIX} are occasionally incompatible with older |
| 1925 | +versions. For example, older versions of @acronym{POSIX} required the |
| 1926 | +command @samp{sort +1} to sort based on the second and succeeding |
| 1927 | +fields in each input line, but starting with @acronym{POSIX} 1003.1-2001 |
| 1928 | +the same command is required to sort the file named @file{+1}, and you |
| 1929 | +must instead use the command @samp{sort -k 2} to get the field-based |
| 1930 | +sort. |
| 1931 | + |
| 1932 | +@vindex _POSIX2_VERSION |
| 1933 | +The @sc{gnu} utilities normally conform to the version of @acronym{POSIX} |
| 1934 | +that is standard for your system. To cause them to conform to a |
| 1935 | +different version of @acronym{POSIX}, define the @env{_POSIX2_VERSION} |
| 1936 | +environment variable to a value of the form @var{yyyymm} specifying |
| 1937 | +the year and month the standard was adopted. Two values are currently |
| 1938 | +supported for @env{_POSIX2_VERSION}: @samp{199209} stands for |
| 1939 | +@acronym{POSIX} 1003.2-1992, and @samp{200112} stands for @acronym{POSIX} |
| 1940 | +1003.1-2001. For example, if you have a newer system but are running software |
| 1941 | +that assumes an older version of @acronym{POSIX} and uses @samp{sort +1} |
| 1942 | +or @samp{tail +10}, you can work around any compatibility problems by setting |
| 1943 | +@samp{_POSIX2_VERSION=199209} in your environment. |
| 1944 | + |
| 1945 | +@node Output of entire files |
| 1946 | +@chapter Output of entire files |
| 1947 | + |
| 1948 | +@cindex output of entire files |
| 1949 | +@cindex entire files, output of |
| 1950 | + |
| 1951 | +These commands read and write entire files, possibly transforming them |
| 1952 | +in some way. |
| 1953 | + |
| 1954 | +@menu |
| 1955 | +* cat invocation:: Concatenate and write files. |
| 1956 | +* tac invocation:: Concatenate and write files in reverse. |
| 1957 | +* nl invocation:: Number lines and write files. |
| 1958 | +* od invocation:: Write files in octal or other formats. |
| 1959 | +* base64 invocation:: Transform data into printable data. |
| 1960 | +@end menu |
| 1961 | + |
| 1962 | +@node cat invocation |
| 1963 | +@section @command{cat}: Concatenate and write files |
| 1964 | + |
| 1965 | +@pindex cat |
| 1966 | +@cindex concatenate and write files |
| 1967 | +@cindex copying files |
| 1968 | + |
| 1969 | +@command{cat} copies each @var{file} (@samp{-} means standard input), or |
| 1970 | +standard input if none are given, to standard output. Synopsis: |
| 1971 | + |