mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-26 23:33:08 +02:00
new GLOBSORT variable
This commit is contained in:
@@ -6001,3 +6001,33 @@ sig.c,sig.h
|
||||
not set anywhere yet), call sigpipe_handler instead of terminating
|
||||
the shell. Still need to make sure a sighandler is installed for
|
||||
SIGPIPE even if initialize_terminating_signals isn't called
|
||||
|
||||
4/14
|
||||
----
|
||||
lib/sh/tmpfile.c
|
||||
- sh_mktmpfd: add support for MT_UNLINK flag, unlinks created filename
|
||||
before returning fd, fails if the unlink fails for some reason
|
||||
|
||||
4/15
|
||||
----
|
||||
pathexp.c,pathexp.h
|
||||
- globsort: support for various glob sorting criteria as defined by
|
||||
the GLOBSORT variable: name, size, blocks, mtime, atime, ctime.
|
||||
Default is ascending sort by name, as is traditional. Based on an
|
||||
idea from Evan Gates <evan.gates@gmail.com>
|
||||
- setup_globsort: parse the value of the GLOBSORT variable, find
|
||||
sorting type and whether or not it's ascending or descending
|
||||
- noquote_glob_filename: glob_filename for programmable completion,
|
||||
doesn't call quote_string_for_globbing and honors GLOBSORT, dotglob,
|
||||
and globstar
|
||||
|
||||
pcomplete.c
|
||||
- gen_globpat_matches: call noquote_glob_filename, let that handle
|
||||
all the variables and GLOB_FAILED
|
||||
|
||||
variables.c
|
||||
- GLOBSORT: support for special variable, call setup_globsort on
|
||||
set or unset
|
||||
|
||||
doc/bash.1,doc/bashref.texi
|
||||
- GLOBSORT: document variable and its effects on pathname expansion
|
||||
|
||||
@@ -398,6 +398,7 @@ lib/readline/examples/rl.c f
|
||||
lib/readline/examples/rlcat.c f
|
||||
lib/readline/examples/Inputrc f
|
||||
lib/sh/Makefile.in f
|
||||
lib/sh/anonfile.c f
|
||||
lib/sh/casemod.c f
|
||||
lib/sh/clktck.c f
|
||||
lib/sh/clock.c f
|
||||
@@ -444,8 +445,10 @@ lib/sh/strerror.c f
|
||||
lib/sh/strftime.c f
|
||||
lib/sh/stringlist.c f
|
||||
lib/sh/stringvec.c f
|
||||
lib/sh/strlcpy.c f
|
||||
lib/sh/strnlen.c f
|
||||
lib/sh/strpbrk.c f
|
||||
lib/sh/strscpy.c f
|
||||
lib/sh/strstr.c f
|
||||
lib/sh/strtod.c f
|
||||
lib/sh/strtoimax.c f
|
||||
|
||||
+3
-2
@@ -236,7 +236,7 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
|
||||
${SH_LIBSRC}/eaccess.c ${SH_LIBSRC}/wcsdup.c \
|
||||
${SH_LIBSRC}/zmapfd.c ${SH_LIBSRC}/fpurge.c \
|
||||
${SH_LIBSRC}/zgetline.c ${SH_LIBSRC}/mbscmp.c \
|
||||
${SH_LIBSRC}/mbsncmp.c \
|
||||
${SH_LIBSRC}/mbsncmp.c ${SH_LIBSRC}/anonfile.c \
|
||||
${SH_LIBSRC}/casemod.c ${SH_LIBSRC}/uconvert.c \
|
||||
${SH_LIBSRC}/ufuncs.c ${SH_LIBSRC}/dprintf.c \
|
||||
${SH_LIBSRC}/input_avail.c ${SH_LIBSRC}/mbscasecmp.c \
|
||||
@@ -244,7 +244,8 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
|
||||
${SH_LIBSRC}/wcswidth.c ${SH_LIBSRC}/wcsnwidth.c \
|
||||
${SH_LIBSRC}/shmbchar.c ${SH_LIBSRC}/utf8.c \
|
||||
${SH_LIBSRC}/random.c ${SH_LIBSRC}/gettimeofday.c \
|
||||
${SH_LIBSRC}/timers.c ${SH_LIBSRC}/strvis.c
|
||||
${SH_LIBSRC}/timers.c ${SH_LIBSRC}/strvis.c \
|
||||
${SH_LIBSRC}/strlcpy.c ${SH_LIBSRC}/strscpy.c
|
||||
|
||||
SHLIB_LIB = -lsh
|
||||
SHLIB_LIBNAME = libsh.a
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@
|
||||
the Posix.2 confstr () function, or CS_PATH define are not present. */
|
||||
#ifndef STANDARD_UTILS_PATH
|
||||
#define STANDARD_UTILS_PATH \
|
||||
"/bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/etc"
|
||||
"/bin:/usr/bin:/sbin:/usr/sbin"
|
||||
#endif
|
||||
|
||||
/* The default path for enable -f */
|
||||
|
||||
+12
@@ -750,6 +750,9 @@
|
||||
/* Define if you have the mbsrtowcs function. */
|
||||
#undef HAVE_MBSRTOWCS
|
||||
|
||||
/* Define if you have the memfd_create function. */
|
||||
#undef HAVE_MEMFD_CREATE
|
||||
|
||||
/* Define if you have the memmove function. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
@@ -828,6 +831,12 @@
|
||||
#undef HAVE_SETRESUID
|
||||
#undef HAVE_DECL_SETRESUID
|
||||
|
||||
/* Define if you have the shm_open function. */
|
||||
#undef HAVE_SHM_OPEN
|
||||
|
||||
/* Define if you have the shm_mkstemp function. */
|
||||
#undef HAVE_SHM_MKSTEMP
|
||||
|
||||
/* Define if you have the setvbuf function. */
|
||||
#undef HAVE_SETVBUF
|
||||
|
||||
@@ -861,6 +870,9 @@
|
||||
/* Define if you have the strftime function. */
|
||||
#undef HAVE_STRFTIME
|
||||
|
||||
/* Define if you have the strlcat function. */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define if you have the strnlen function. */
|
||||
#undef HAVE_STRNLEN
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# From configure.ac for Bash 5.2, version 5.049.
|
||||
# From configure.ac for Bash 5.2, version 5.050.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.71 for bash 5.2-maint.
|
||||
#
|
||||
@@ -15305,6 +15305,33 @@ then :
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat"
|
||||
if test "x$ac_cv_func_strlcat" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_STRLCAT 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "memfd_create" "ac_cv_func_memfd_create"
|
||||
if test "x$ac_cv_func_memfd_create" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_MEMFD_CREATE 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_func "$LINENO" "shm_open" "ac_cv_func_shm_open"
|
||||
if test "x$ac_cv_func_shm_open" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_SHM_OPEN 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_func "$LINENO" "shm_mkstemp" "ac_cv_func_shm_mkstemp"
|
||||
if test "x$ac_cv_func_shm_mkstemp" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_SHM_MKSTEMP 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd"
|
||||
if test "x$ac_cv_func_getcwd" = xyes
|
||||
@@ -15546,6 +15573,20 @@ esac
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy"
|
||||
if test "x$ac_cv_func_strlcpy" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_STRLCPY 1" >>confdefs.h
|
||||
|
||||
else $as_nop
|
||||
case " $LIBOBJS " in
|
||||
*" strlcpy.$ac_objext "* ) ;;
|
||||
*) LIBOBJS="$LIBOBJS strlcpy.$ac_objext"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
|
||||
ac_fn_c_check_header_compile "$LINENO" "libaudit.h" "ac_cv_header_libaudit_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_libaudit_h" = xyes
|
||||
|
||||
+5
-1
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_REVISION([for Bash 5.2, version 5.049])dnl
|
||||
AC_REVISION([for Bash 5.2, version 5.050])dnl
|
||||
|
||||
define(bashvers, 5.2)
|
||||
define(relstatus, maint)
|
||||
@@ -857,6 +857,9 @@ AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
|
||||
AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
|
||||
AC_CHECK_FUNCS(mkstemp mkdtemp)
|
||||
AC_CHECK_FUNCS(arc4random)
|
||||
AC_CHECK_FUNCS(strlcat)
|
||||
|
||||
AC_CHECK_FUNCS(memfd_create shm_open shm_mkstemp)
|
||||
|
||||
AC_REPLACE_FUNCS(getcwd memset)
|
||||
AC_REPLACE_FUNCS(strcasecmp strcasestr strerror strftime strnlen strpbrk strstr)
|
||||
@@ -864,6 +867,7 @@ AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoumax)
|
||||
AC_REPLACE_FUNCS(dprintf)
|
||||
AC_REPLACE_FUNCS(strchrnul)
|
||||
AC_REPLACE_FUNCS(strdup)
|
||||
AC_REPLACE_FUNCS(strlcpy)
|
||||
|
||||
AC_CHECK_HEADERS(libaudit.h)
|
||||
AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
|
||||
|
||||
+473
-453
File diff suppressed because it is too large
Load Diff
+34
-2
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Tue Mar 14 16:19:06 EDT 2023
|
||||
.\" Last Change: Sat Apr 15 17:52:31 EDT 2023
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2023 March 14" "GNU Bash 5.2"
|
||||
.TH BASH 1 "2023 April 15" "GNU Bash 5.2"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -2248,6 +2248,32 @@ of the patterns in
|
||||
.BR GLOBIGNORE ,
|
||||
it is removed from the list of matches.
|
||||
.TP
|
||||
.B GLOBSORT
|
||||
Control how the results of pathname expansion are sorted.
|
||||
The value of this variable specifies the sort criteria and sort order for
|
||||
the results of pathname expansion.
|
||||
If this variable is unset or set to the null string, pathname expansion
|
||||
uses the historial behavior of sorting by name.
|
||||
If set, a valid value begins with an optional \fI+\fP, which is ignored,
|
||||
or \fI\-\fP, which reverses the sort order from ascending to descending,
|
||||
followed by a sort specifier.
|
||||
The valid sort specifiers are
|
||||
.IR name ,
|
||||
.IR size ,
|
||||
.IR mtime ,
|
||||
.IR atime ,
|
||||
.IR ctime ,
|
||||
and
|
||||
.IR blocks ,
|
||||
which sort the files on name, file size, modification time, access time,
|
||||
inode change time, and number of blocks, respectively.
|
||||
For example, a value of \fB\-mtime\fP sorts the results in descending
|
||||
order by modification time (newest first).
|
||||
If the sort specifier is missing, it defaults to \fIname\fP,
|
||||
so a value of \fI+\fP is equivalent to the null string,
|
||||
and a value of \fI-\fP sorts by name in descending order.
|
||||
Any invalid value restores the historical sorting behavior.
|
||||
.TP
|
||||
.B HISTCONTROL
|
||||
A colon-separated list of values controlling how commands are saved on
|
||||
the history list.
|
||||
@@ -3859,6 +3885,12 @@ is unset.
|
||||
The pattern matching honors the setting of the \fBextglob\fP shell
|
||||
option.
|
||||
.PP
|
||||
The
|
||||
.SM
|
||||
.B GLOBSORT
|
||||
variable controls how the results of pathname expansion are sorted, as
|
||||
described above.
|
||||
.PP
|
||||
\fBPattern Matching\fP
|
||||
.PP
|
||||
Any character that appears in a pattern, other than the special pattern
|
||||
|
||||
+265
-174
@@ -1,9 +1,9 @@
|
||||
This is bash.info, produced by makeinfo version 6.8 from bashref.texi.
|
||||
|
||||
This text is a brief description of the features that are present in the
|
||||
Bash shell (version 5.2, 14 March 2023).
|
||||
Bash shell (version 5.2, 15 April 2023).
|
||||
|
||||
This is Edition 5.2, last updated 14 March 2023, of 'The GNU Bash
|
||||
This is Edition 5.2, last updated 15 April 2023, of 'The GNU Bash
|
||||
Reference Manual', for 'Bash', Version 5.2.
|
||||
|
||||
Copyright (C) 1988-2023 Free Software Foundation, Inc.
|
||||
@@ -26,10 +26,10 @@ Bash Features
|
||||
*************
|
||||
|
||||
This text is a brief description of the features that are present in the
|
||||
Bash shell (version 5.2, 14 March 2023). The Bash home page is
|
||||
Bash shell (version 5.2, 15 April 2023). The Bash home page is
|
||||
<http://www.gnu.org/software/bash/>.
|
||||
|
||||
This is Edition 5.2, last updated 14 March 2023, of 'The GNU Bash
|
||||
This is Edition 5.2, last updated 15 April 2023, of 'The GNU Bash
|
||||
Reference Manual', for 'Bash', Version 5.2.
|
||||
|
||||
Bash contains features that appear in other popular shells, and some
|
||||
@@ -2409,6 +2409,10 @@ behavior of ignoring filenames beginning with a '.', make '.*' one of
|
||||
the patterns in 'GLOBIGNORE'. The 'dotglob' option is disabled when
|
||||
'GLOBIGNORE' is unset.
|
||||
|
||||
After the pattern is expanded and matched against filenames, the
|
||||
value of the 'GLOBSORT' variable controls how the results are sorted, as
|
||||
described below (*note Bash Variables::).
|
||||
|
||||
|
||||
File: bash.info, Node: Pattern Matching, Up: Filename Expansion
|
||||
|
||||
@@ -2574,7 +2578,7 @@ was redirected to DIRLIST.
|
||||
|
||||
Bash handles several filenames specially when they are used in
|
||||
redirections, as described in the following table. If the operating
|
||||
system on which Bash is running provides these special files, bash will
|
||||
system on which Bash is running provides these special files, Bash will
|
||||
use them; otherwise it will emulate them internally with the behavior
|
||||
described below.
|
||||
|
||||
@@ -3249,7 +3253,7 @@ standard.
|
||||
than or equal to 1.
|
||||
|
||||
'cd'
|
||||
cd [-L|[-P [-e]] [-@] [DIRECTORY]
|
||||
cd [-L|[-P [-e]]] [-@] [DIRECTORY]
|
||||
|
||||
Change the current working directory to DIRECTORY. If DIRECTORY is
|
||||
not supplied, the value of the 'HOME' shell variable is used. If
|
||||
@@ -4854,7 +4858,7 @@ This builtin allows you to change additional shell optional behavior.
|
||||
words to be completed. This means that dollar signs in
|
||||
variable names that expand to directories will not be quoted;
|
||||
however, any dollar signs appearing in filenames will not be
|
||||
quoted, either. This is active only when bash is using
|
||||
quoted, either. This is active only when Bash is using
|
||||
backslashes to quote completed filenames. This variable is
|
||||
set by default, which is the default Bash behavior in versions
|
||||
through 4.2.
|
||||
@@ -5259,7 +5263,7 @@ Variables::).
|
||||
|
||||
'BASH_ARGC'
|
||||
An array variable whose values are the number of parameters in each
|
||||
frame of the current bash execution call stack. The number of
|
||||
frame of the current Bash execution call stack. The number of
|
||||
parameters to the current subroutine (shell function or script
|
||||
executed with '.' or 'source') is at the top of the stack. When a
|
||||
subroutine is executed, the number of parameters passed is pushed
|
||||
@@ -5272,7 +5276,7 @@ Variables::).
|
||||
|
||||
'BASH_ARGV'
|
||||
An array variable containing all of the parameters in the current
|
||||
bash execution call stack. The final parameter of the last
|
||||
Bash execution call stack. The final parameter of the last
|
||||
subroutine call is at the top of the stack; the first parameter of
|
||||
the initial call is at the bottom. When a subroutine is executed,
|
||||
the parameters supplied are pushed onto 'BASH_ARGV'. The shell
|
||||
@@ -5561,6 +5565,28 @@ Variables::).
|
||||
'GLOBIGNORE', it is removed from the list of matches. The pattern
|
||||
matching honors the setting of the 'extglob' shell option.
|
||||
|
||||
'GLOBSORT'
|
||||
Control how the results of filename expansion are sorted. The
|
||||
value of this variable specifies the sort criteria and sort order
|
||||
for the results of filename expansion. If this variable is unset
|
||||
or set to the null string, filename expansion uses the historial
|
||||
behavior of sorting by name. If set, a valid value begins with an
|
||||
optional '+', which is ignored, or '-', which reverses the sort
|
||||
order from ascending to descending, followed by a sort specifier.
|
||||
The valid sort specifiers are 'name', 'size', 'mtime', 'atime',
|
||||
'ctime', and 'blocks', which sort the files on name, file size,
|
||||
modification time, access time, inode change time, and number of
|
||||
blocks, respectively.
|
||||
|
||||
For example, a value of '-mtime' sorts the results in descending
|
||||
order by modification time (newest first).
|
||||
|
||||
If the sort specifier is missing, it defaults to NAME, so a value
|
||||
of '+' is equivalent to the null string, and a value of '-' sorts
|
||||
by name in descending order.
|
||||
|
||||
Any invalid value restores the historical sorting behavior.
|
||||
|
||||
'GROUPS'
|
||||
An array variable containing the list of groups of which the
|
||||
current user is a member. Assignments to 'GROUPS' have no effect.
|
||||
@@ -6573,7 +6599,7 @@ decreasing precedence.
|
||||
'||'
|
||||
logical OR
|
||||
|
||||
'expr ? expr : expr'
|
||||
'expr ? if-true-expr : if-false-expr'
|
||||
conditional operator
|
||||
|
||||
'= *= /= %= += -= <<= >>= &= ^= |='
|
||||
@@ -7069,13 +7095,60 @@ environment, such as 'jails', 'zones', or 'containers'.
|
||||
|
||||
File: bash.info, Node: Bash POSIX Mode, Next: Shell Compatibility Mode, Prev: The Restricted Shell, Up: Bash Features
|
||||
|
||||
6.11 Bash POSIX Mode
|
||||
====================
|
||||
6.11 Bash and POSIX
|
||||
===================
|
||||
|
||||
Starting Bash with the '--posix' command-line option or executing 'set
|
||||
-o posix' while Bash is running will cause Bash to conform more closely
|
||||
to the POSIX standard by changing the behavior to match that specified
|
||||
by POSIX in areas where the Bash default differs.
|
||||
6.11.1 What is POSIX?
|
||||
---------------------
|
||||
|
||||
POSIX is the name for a family of standards based on Unix. A number of
|
||||
Unix services, tools, and functions are part of the standard, ranging
|
||||
from the basic system calls and C library functions to common
|
||||
applications and tools to system administration and management.
|
||||
|
||||
The POSIX Shell and Utilities standard was originally developed by
|
||||
IEEE Working Group 1003.2 (POSIX.2). The first edition of the 1003.2
|
||||
standard was published in 1992. It was merged with the original IEEE
|
||||
1003.1 Working Group and is currently maintained by the Austin Group (a
|
||||
joint working group of the IEEE, The Open Group and ISO/IEC SC22/WG15).
|
||||
Today the Shell and Utilities are a volume within the set of documents
|
||||
that make up IEEE Std 1003.1-2017, and thus the former POSIX.2 (from
|
||||
1992) is now part of the current unified POSIX standard.
|
||||
|
||||
The Shell and Utilities volume concentrates on the command
|
||||
interpreter interface and utility programs commonly executed from the
|
||||
command line or by other programs. The standard is freely available on
|
||||
the web at
|
||||
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html>.
|
||||
|
||||
Bash is concerned with the aspects of the shell's behavior defined by
|
||||
the POSIX Shell and Utilities volume. The shell command language has of
|
||||
course been standardized, including the basic flow control and program
|
||||
execution constructs, I/O redirection and pipelines, argument handling,
|
||||
variable expansion, and quoting.
|
||||
|
||||
The special builtins, which must be implemented as part of the shell
|
||||
to provide the desired functionality, are specified as being part of the
|
||||
shell; examples of these are 'eval' and 'export'. Other utilities
|
||||
appear in the sections of POSIX not devoted to the shell which are
|
||||
commonly (and in some cases must be) implemented as builtin commands,
|
||||
such as 'read' and 'test'. POSIX also specifies aspects of the shell's
|
||||
interactive behavior, including job control and command line editing.
|
||||
Only vi-style line editing commands have been standardized; emacs
|
||||
editing commands were left out due to objections.
|
||||
|
||||
6.11.2 Bash POSIX Mode
|
||||
----------------------
|
||||
|
||||
Although Bash is an implementation of the POSIX shell specification,
|
||||
there are areas where the Bash default behavior differs from the
|
||||
specification. The Bash "posix mode" changes the Bash behavior in these
|
||||
areas so that it conforms to the standard more closely.
|
||||
|
||||
Starting Bash with the '--posix' command-line option or executing
|
||||
'set -o posix' while Bash is running will cause Bash to conform more
|
||||
closely to the POSIX standard by changing the behavior to match that
|
||||
specified by POSIX in areas where the Bash default differs.
|
||||
|
||||
When invoked as 'sh', Bash enters POSIX mode after reading the
|
||||
startup files.
|
||||
@@ -7338,6 +7411,13 @@ startup files.
|
||||
that a backslash preceding a double quote character will escape it
|
||||
and the backslash will be removed.
|
||||
|
||||
66. Command substitutions don't set the '?' special parameter. The
|
||||
exit status of a simple command without a command word is still the
|
||||
exit status of the last command substitution that occurred while
|
||||
evaluating the variable assignments and redirections in that
|
||||
command, but that does not happen until after all of the
|
||||
assignments and redirections.
|
||||
|
||||
There is other POSIX behavior that Bash does not implement by default
|
||||
even when in POSIX mode. Specifically:
|
||||
|
||||
@@ -7345,7 +7425,11 @@ even when in POSIX mode. Specifically:
|
||||
entries if 'FCEDIT' is unset, rather than defaulting directly to
|
||||
'ed'. 'fc' uses 'ed' if 'EDITOR' is unset.
|
||||
|
||||
2. As noted above, Bash requires the 'xpg_echo' option to be enabled
|
||||
2. A non-interactive shell does not exit if a variable assignment
|
||||
preceding the 'command' builtin or another non-special builtin
|
||||
fails.
|
||||
|
||||
3. As noted above, Bash requires the 'xpg_echo' option to be enabled
|
||||
for the 'echo' builtin to be fully conformant.
|
||||
|
||||
Bash can be configured to be POSIX-conformant by default, by
|
||||
@@ -10485,7 +10569,7 @@ at the Bash prompt in your Bash source directory.
|
||||
If you want to build Bash in a directory separate from the source
|
||||
directory - to build for multiple architectures, for example - just use
|
||||
the full path to the configure script. The following commands will
|
||||
build bash in a directory under '/usr/local/build' from the source code
|
||||
build Bash in a directory under '/usr/local/build' from the source code
|
||||
in '/usr/local/src/bash-4.4':
|
||||
|
||||
mkdir /usr/local/build/bash-4.4
|
||||
@@ -10578,7 +10662,7 @@ By default, 'make install' will install into '/usr/local/bin',
|
||||
specifying a value for the 'prefix' 'make' variable when running 'make
|
||||
install' (e.g., 'make install prefix=PATH'). The 'prefix' variable
|
||||
provides a default for 'exec_prefix' and other variables used when
|
||||
installing bash.
|
||||
installing Bash.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
@@ -10591,7 +10675,7 @@ run, you can specify these variables as arguments to 'make': 'make
|
||||
install exec_prefix=/' will install 'bash' and 'bashbug' into '/bin'
|
||||
instead of the default '/usr/local/bin'.
|
||||
|
||||
If you want to see the files bash will install and where it will
|
||||
If you want to see the files Bash will install and where it will
|
||||
install them without changing anything on your system, specify the
|
||||
variable 'DESTDIR' as an argument to 'make'. Its value should be the
|
||||
absolute directory path you'd like to use as the root of your sample
|
||||
@@ -10773,7 +10857,7 @@ does not provide the necessary support.
|
||||
builtins (*note Aliases::).
|
||||
|
||||
'--enable-alt-array-implementation'
|
||||
This builds bash using an alternate implementation of arrays (*note
|
||||
This builds Bash using an alternate implementation of arrays (*note
|
||||
Arrays::) that provides faster access at the expense of using more
|
||||
memory (sometimes many times more, depending on how sparse an array
|
||||
is).
|
||||
@@ -10824,7 +10908,7 @@ does not provide the necessary support.
|
||||
(*note Pipelines::).
|
||||
|
||||
'--enable-debugger'
|
||||
Include support for the bash debugger (distributed separately).
|
||||
Include support for the Bash debugger (distributed separately).
|
||||
|
||||
'--enable-dev-fd-stat-broken'
|
||||
If calling 'stat' on /dev/fd/N returns different results than
|
||||
@@ -10962,11 +11046,11 @@ of Bash. The latest version of Bash is always available for FTP from
|
||||
<http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-master.tar.gz>.
|
||||
|
||||
Once you have determined that a bug actually exists, use the
|
||||
'bashbug' command to submit a bug report or use the form at the <a
|
||||
href="https://savannah.gnu.org/projects/bash/">Bash project page</a>.
|
||||
If you have a fix, you are encouraged to submit that as well!
|
||||
Suggestions and 'philosophical' bug reports may be mailed to
|
||||
<bug-bash@gnu.org> or <help-bash@gnu.org>.
|
||||
'bashbug' command to submit a bug report or use the form at the Bash
|
||||
project page (https://savannah.gnu.org/projects/bash/). If you have a
|
||||
fix, you are encouraged to submit that as well! Suggestions and
|
||||
'philosophical' bug reports may be mailed to <bug-bash@gnu.org> or
|
||||
<help-bash@gnu.org>.
|
||||
|
||||
All bug reports should include:
|
||||
* The version number of Bash.
|
||||
@@ -12110,57 +12194,58 @@ D.3 Parameter and Variable Index
|
||||
* FUNCNAME: Bash Variables. (line 326)
|
||||
* FUNCNEST: Bash Variables. (line 343)
|
||||
* GLOBIGNORE: Bash Variables. (line 348)
|
||||
* GROUPS: Bash Variables. (line 355)
|
||||
* histchars: Bash Variables. (line 361)
|
||||
* HISTCMD: Bash Variables. (line 376)
|
||||
* HISTCONTROL: Bash Variables. (line 382)
|
||||
* HISTFILE: Bash Variables. (line 398)
|
||||
* HISTFILESIZE: Bash Variables. (line 402)
|
||||
* HISTIGNORE: Bash Variables. (line 413)
|
||||
* GLOBSORT: Bash Variables. (line 355)
|
||||
* GROUPS: Bash Variables. (line 377)
|
||||
* histchars: Bash Variables. (line 383)
|
||||
* HISTCMD: Bash Variables. (line 398)
|
||||
* HISTCONTROL: Bash Variables. (line 404)
|
||||
* HISTFILE: Bash Variables. (line 420)
|
||||
* HISTFILESIZE: Bash Variables. (line 424)
|
||||
* HISTIGNORE: Bash Variables. (line 435)
|
||||
* history-preserve-point: Readline Init File Syntax.
|
||||
(line 211)
|
||||
* history-size: Readline Init File Syntax.
|
||||
(line 217)
|
||||
* HISTSIZE: Bash Variables. (line 433)
|
||||
* HISTTIMEFORMAT: Bash Variables. (line 440)
|
||||
* HISTSIZE: Bash Variables. (line 455)
|
||||
* HISTTIMEFORMAT: Bash Variables. (line 462)
|
||||
* HOME: Bourne Shell Variables.
|
||||
(line 13)
|
||||
* horizontal-scroll-mode: Readline Init File Syntax.
|
||||
(line 226)
|
||||
* HOSTFILE: Bash Variables. (line 448)
|
||||
* HOSTNAME: Bash Variables. (line 459)
|
||||
* HOSTTYPE: Bash Variables. (line 462)
|
||||
* HOSTFILE: Bash Variables. (line 470)
|
||||
* HOSTNAME: Bash Variables. (line 481)
|
||||
* HOSTTYPE: Bash Variables. (line 484)
|
||||
* IFS: Bourne Shell Variables.
|
||||
(line 18)
|
||||
* IGNOREEOF: Bash Variables. (line 465)
|
||||
* IGNOREEOF: Bash Variables. (line 487)
|
||||
* input-meta: Readline Init File Syntax.
|
||||
(line 235)
|
||||
* INPUTRC: Bash Variables. (line 475)
|
||||
* INSIDE_EMACS: Bash Variables. (line 479)
|
||||
* INPUTRC: Bash Variables. (line 497)
|
||||
* INSIDE_EMACS: Bash Variables. (line 501)
|
||||
* isearch-terminators: Readline Init File Syntax.
|
||||
(line 245)
|
||||
* keymap: Readline Init File Syntax.
|
||||
(line 252)
|
||||
* LANG: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* LANG <1>: Bash Variables. (line 485)
|
||||
* LC_ALL: Bash Variables. (line 489)
|
||||
* LC_COLLATE: Bash Variables. (line 493)
|
||||
* LC_CTYPE: Bash Variables. (line 500)
|
||||
* LANG <1>: Bash Variables. (line 507)
|
||||
* LC_ALL: Bash Variables. (line 511)
|
||||
* LC_COLLATE: Bash Variables. (line 515)
|
||||
* LC_CTYPE: Bash Variables. (line 522)
|
||||
* LC_MESSAGES: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* LC_MESSAGES <1>: Bash Variables. (line 505)
|
||||
* LC_NUMERIC: Bash Variables. (line 509)
|
||||
* LC_TIME: Bash Variables. (line 513)
|
||||
* LINENO: Bash Variables. (line 517)
|
||||
* LINES: Bash Variables. (line 522)
|
||||
* MACHTYPE: Bash Variables. (line 528)
|
||||
* LC_MESSAGES <1>: Bash Variables. (line 527)
|
||||
* LC_NUMERIC: Bash Variables. (line 531)
|
||||
* LC_TIME: Bash Variables. (line 535)
|
||||
* LINENO: Bash Variables. (line 539)
|
||||
* LINES: Bash Variables. (line 544)
|
||||
* MACHTYPE: Bash Variables. (line 550)
|
||||
* MAIL: Bourne Shell Variables.
|
||||
(line 22)
|
||||
* MAILCHECK: Bash Variables. (line 532)
|
||||
* MAILCHECK: Bash Variables. (line 554)
|
||||
* MAILPATH: Bourne Shell Variables.
|
||||
(line 27)
|
||||
* MAPFILE: Bash Variables. (line 540)
|
||||
* MAPFILE: Bash Variables. (line 562)
|
||||
* mark-modified-lines: Readline Init File Syntax.
|
||||
(line 282)
|
||||
* mark-symlinked-directories: Readline Init File Syntax.
|
||||
@@ -12171,46 +12256,46 @@ D.3 Parameter and Variable Index
|
||||
(line 299)
|
||||
* meta-flag: Readline Init File Syntax.
|
||||
(line 235)
|
||||
* OLDPWD: Bash Variables. (line 544)
|
||||
* OLDPWD: Bash Variables. (line 566)
|
||||
* OPTARG: Bourne Shell Variables.
|
||||
(line 34)
|
||||
* OPTERR: Bash Variables. (line 547)
|
||||
* OPTERR: Bash Variables. (line 569)
|
||||
* OPTIND: Bourne Shell Variables.
|
||||
(line 38)
|
||||
* OSTYPE: Bash Variables. (line 551)
|
||||
* OSTYPE: Bash Variables. (line 573)
|
||||
* output-meta: Readline Init File Syntax.
|
||||
(line 304)
|
||||
* page-completions: Readline Init File Syntax.
|
||||
(line 312)
|
||||
* PATH: Bourne Shell Variables.
|
||||
(line 42)
|
||||
* PIPESTATUS: Bash Variables. (line 554)
|
||||
* POSIXLY_CORRECT: Bash Variables. (line 559)
|
||||
* PPID: Bash Variables. (line 569)
|
||||
* PROMPT_COMMAND: Bash Variables. (line 573)
|
||||
* PROMPT_DIRTRIM: Bash Variables. (line 579)
|
||||
* PS0: Bash Variables. (line 585)
|
||||
* PIPESTATUS: Bash Variables. (line 576)
|
||||
* POSIXLY_CORRECT: Bash Variables. (line 581)
|
||||
* PPID: Bash Variables. (line 591)
|
||||
* PROMPT_COMMAND: Bash Variables. (line 595)
|
||||
* PROMPT_DIRTRIM: Bash Variables. (line 601)
|
||||
* PS0: Bash Variables. (line 607)
|
||||
* PS1: Bourne Shell Variables.
|
||||
(line 48)
|
||||
* PS2: Bourne Shell Variables.
|
||||
(line 53)
|
||||
* PS3: Bash Variables. (line 590)
|
||||
* PS4: Bash Variables. (line 595)
|
||||
* PWD: Bash Variables. (line 603)
|
||||
* RANDOM: Bash Variables. (line 606)
|
||||
* READLINE_ARGUMENT: Bash Variables. (line 612)
|
||||
* READLINE_LINE: Bash Variables. (line 616)
|
||||
* READLINE_MARK: Bash Variables. (line 620)
|
||||
* READLINE_POINT: Bash Variables. (line 626)
|
||||
* REPLY: Bash Variables. (line 630)
|
||||
* PS3: Bash Variables. (line 612)
|
||||
* PS4: Bash Variables. (line 617)
|
||||
* PWD: Bash Variables. (line 625)
|
||||
* RANDOM: Bash Variables. (line 628)
|
||||
* READLINE_ARGUMENT: Bash Variables. (line 634)
|
||||
* READLINE_LINE: Bash Variables. (line 638)
|
||||
* READLINE_MARK: Bash Variables. (line 642)
|
||||
* READLINE_POINT: Bash Variables. (line 648)
|
||||
* REPLY: Bash Variables. (line 652)
|
||||
* revert-all-at-newline: Readline Init File Syntax.
|
||||
(line 322)
|
||||
* search-ignore-case: Readline Init File Syntax.
|
||||
(line 329)
|
||||
* SECONDS: Bash Variables. (line 633)
|
||||
* SHELL: Bash Variables. (line 642)
|
||||
* SHELLOPTS: Bash Variables. (line 647)
|
||||
* SHLVL: Bash Variables. (line 656)
|
||||
* SECONDS: Bash Variables. (line 655)
|
||||
* SHELL: Bash Variables. (line 664)
|
||||
* SHELLOPTS: Bash Variables. (line 669)
|
||||
* SHLVL: Bash Variables. (line 678)
|
||||
* show-all-if-ambiguous: Readline Init File Syntax.
|
||||
(line 334)
|
||||
* show-all-if-unmodified: Readline Init File Syntax.
|
||||
@@ -12219,15 +12304,15 @@ D.3 Parameter and Variable Index
|
||||
(line 349)
|
||||
* skip-completed-text: Readline Init File Syntax.
|
||||
(line 355)
|
||||
* SRANDOM: Bash Variables. (line 661)
|
||||
* SRANDOM: Bash Variables. (line 683)
|
||||
* TEXTDOMAIN: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* TEXTDOMAINDIR: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* TIMEFORMAT: Bash Variables. (line 670)
|
||||
* TMOUT: Bash Variables. (line 708)
|
||||
* TMPDIR: Bash Variables. (line 720)
|
||||
* UID: Bash Variables. (line 724)
|
||||
* TIMEFORMAT: Bash Variables. (line 692)
|
||||
* TMOUT: Bash Variables. (line 730)
|
||||
* TMPDIR: Bash Variables. (line 742)
|
||||
* UID: Bash Variables. (line 746)
|
||||
* vi-cmd-mode-string: Readline Init File Syntax.
|
||||
(line 368)
|
||||
* vi-ins-mode-string: Readline Init File Syntax.
|
||||
@@ -12454,11 +12539,14 @@ D.5 Concept Index
|
||||
* arithmetic evaluation: Shell Arithmetic. (line 6)
|
||||
* arithmetic expansion: Arithmetic Expansion.
|
||||
(line 6)
|
||||
* arithmetic operators: Shell Arithmetic. (line 17)
|
||||
* arithmetic, shell: Shell Arithmetic. (line 6)
|
||||
* arrays: Arrays. (line 6)
|
||||
* background: Job Control Basics. (line 6)
|
||||
* Bash configuration: Basic Installation. (line 6)
|
||||
* Bash installation: Basic Installation. (line 6)
|
||||
* binary arithmetic operators: Shell Arithmetic. (line 17)
|
||||
* bitwise arithmetic operators: Shell Arithmetic. (line 17)
|
||||
* Bourne shell: Basic Shell Features.
|
||||
(line 6)
|
||||
* brace expansion: Brace Expansion. (line 6)
|
||||
@@ -12492,6 +12580,7 @@ D.5 Concept Index
|
||||
(line 6)
|
||||
* completion builtins: Programmable Completion Builtins.
|
||||
(line 6)
|
||||
* conditional arithmetic operator: Shell Arithmetic. (line 17)
|
||||
* configuration: Basic Installation. (line 6)
|
||||
* control operator: Definitions. (line 21)
|
||||
* coprocess: Coprocesses. (line 6)
|
||||
@@ -12566,7 +12655,8 @@ D.5 Concept Index
|
||||
* pattern matching: Pattern Matching. (line 6)
|
||||
* pipeline: Pipelines. (line 6)
|
||||
* POSIX: Definitions. (line 9)
|
||||
* POSIX Mode: Bash POSIX Mode. (line 6)
|
||||
* POSIX description: Bash POSIX Mode. (line 9)
|
||||
* POSIX Mode: Bash POSIX Mode. (line 48)
|
||||
* process group: Definitions. (line 62)
|
||||
* process group ID: Definitions. (line 66)
|
||||
* process substitution: Process Substitution.
|
||||
@@ -12601,6 +12691,7 @@ D.5 Concept Index
|
||||
* tilde expansion: Tilde Expansion. (line 6)
|
||||
* token: Definitions. (line 86)
|
||||
* translation, native languages: Locale Translation. (line 6)
|
||||
* unary arithmetic operators: Shell Arithmetic. (line 17)
|
||||
* variable, shell: Shell Parameters. (line 6)
|
||||
* variables, readline: Readline Init File Syntax.
|
||||
(line 37)
|
||||
@@ -12652,98 +12743,98 @@ Node: Arithmetic Expansion97645
|
||||
Node: Process Substitution98610
|
||||
Node: Word Splitting99727
|
||||
Node: Filename Expansion101772
|
||||
Node: Pattern Matching104518
|
||||
Node: Quote Removal109517
|
||||
Node: Redirections109809
|
||||
Node: Executing Commands119499
|
||||
Node: Simple Command Expansion120166
|
||||
Node: Command Search and Execution122273
|
||||
Node: Command Execution Environment124657
|
||||
Node: Environment127689
|
||||
Node: Exit Status129349
|
||||
Node: Signals131130
|
||||
Node: Shell Scripts134576
|
||||
Node: Shell Builtin Commands137600
|
||||
Node: Bourne Shell Builtins139635
|
||||
Node: Bash Builtins161830
|
||||
Node: Modifying Shell Behavior193826
|
||||
Node: The Set Builtin194168
|
||||
Node: The Shopt Builtin204763
|
||||
Node: Special Builtins220672
|
||||
Node: Shell Variables221648
|
||||
Node: Bourne Shell Variables222082
|
||||
Node: Bash Variables224183
|
||||
Node: Bash Features256995
|
||||
Node: Invoking Bash258005
|
||||
Node: Bash Startup Files264015
|
||||
Node: Interactive Shells269143
|
||||
Node: What is an Interactive Shell?269551
|
||||
Node: Is this Shell Interactive?270197
|
||||
Node: Interactive Shell Behavior271009
|
||||
Node: Bash Conditional Expressions274635
|
||||
Node: Shell Arithmetic279274
|
||||
Node: Aliases282215
|
||||
Node: Arrays285106
|
||||
Node: The Directory Stack291666
|
||||
Node: Directory Stack Builtins292447
|
||||
Node: Controlling the Prompt296704
|
||||
Node: The Restricted Shell299666
|
||||
Node: Bash POSIX Mode302273
|
||||
Node: Shell Compatibility Mode315136
|
||||
Node: Job Control323700
|
||||
Node: Job Control Basics324157
|
||||
Node: Job Control Builtins329156
|
||||
Node: Job Control Variables334948
|
||||
Node: Command Line Editing336101
|
||||
Node: Introduction and Notation337769
|
||||
Node: Readline Interaction339389
|
||||
Node: Readline Bare Essentials340577
|
||||
Node: Readline Movement Commands342363
|
||||
Node: Readline Killing Commands343320
|
||||
Node: Readline Arguments345238
|
||||
Node: Searching346279
|
||||
Node: Readline Init File348462
|
||||
Node: Readline Init File Syntax349720
|
||||
Node: Conditional Init Constructs373508
|
||||
Node: Sample Init File377701
|
||||
Node: Bindable Readline Commands380822
|
||||
Node: Commands For Moving382023
|
||||
Node: Commands For History384071
|
||||
Node: Commands For Text389062
|
||||
Node: Commands For Killing392708
|
||||
Node: Numeric Arguments395738
|
||||
Node: Commands For Completion396874
|
||||
Node: Keyboard Macros401062
|
||||
Node: Miscellaneous Commands401747
|
||||
Node: Readline vi Mode407782
|
||||
Node: Programmable Completion408686
|
||||
Node: Programmable Completion Builtins416463
|
||||
Node: A Programmable Completion Example427212
|
||||
Node: Using History Interactively432457
|
||||
Node: Bash History Facilities433138
|
||||
Node: Bash History Builtins436140
|
||||
Node: History Interaction441161
|
||||
Node: Event Designators444778
|
||||
Node: Word Designators446129
|
||||
Node: Modifiers447886
|
||||
Node: Installing Bash449691
|
||||
Node: Basic Installation450825
|
||||
Node: Compilers and Options454544
|
||||
Node: Compiling For Multiple Architectures455282
|
||||
Node: Installation Names456971
|
||||
Node: Specifying the System Type459077
|
||||
Node: Sharing Defaults459791
|
||||
Node: Operation Controls460461
|
||||
Node: Optional Features461416
|
||||
Node: Reporting Bugs472632
|
||||
Node: Major Differences From The Bourne Shell473973
|
||||
Node: GNU Free Documentation License490819
|
||||
Node: Indexes515993
|
||||
Node: Builtin Index516444
|
||||
Node: Reserved Word Index523268
|
||||
Node: Variable Index525713
|
||||
Node: Function Index542625
|
||||
Node: Concept Index556406
|
||||
Node: Pattern Matching104702
|
||||
Node: Quote Removal109701
|
||||
Node: Redirections109993
|
||||
Node: Executing Commands119683
|
||||
Node: Simple Command Expansion120350
|
||||
Node: Command Search and Execution122457
|
||||
Node: Command Execution Environment124841
|
||||
Node: Environment127873
|
||||
Node: Exit Status129533
|
||||
Node: Signals131314
|
||||
Node: Shell Scripts134760
|
||||
Node: Shell Builtin Commands137784
|
||||
Node: Bourne Shell Builtins139819
|
||||
Node: Bash Builtins162015
|
||||
Node: Modifying Shell Behavior194011
|
||||
Node: The Set Builtin194353
|
||||
Node: The Shopt Builtin204948
|
||||
Node: Special Builtins220857
|
||||
Node: Shell Variables221833
|
||||
Node: Bourne Shell Variables222267
|
||||
Node: Bash Variables224368
|
||||
Node: Bash Features258281
|
||||
Node: Invoking Bash259291
|
||||
Node: Bash Startup Files265301
|
||||
Node: Interactive Shells270429
|
||||
Node: What is an Interactive Shell?270837
|
||||
Node: Is this Shell Interactive?271483
|
||||
Node: Interactive Shell Behavior272295
|
||||
Node: Bash Conditional Expressions275921
|
||||
Node: Shell Arithmetic280560
|
||||
Node: Aliases283518
|
||||
Node: Arrays286409
|
||||
Node: The Directory Stack292969
|
||||
Node: Directory Stack Builtins293750
|
||||
Node: Controlling the Prompt298007
|
||||
Node: The Restricted Shell300969
|
||||
Node: Bash POSIX Mode303576
|
||||
Node: Shell Compatibility Mode319366
|
||||
Node: Job Control327930
|
||||
Node: Job Control Basics328387
|
||||
Node: Job Control Builtins333386
|
||||
Node: Job Control Variables339178
|
||||
Node: Command Line Editing340331
|
||||
Node: Introduction and Notation341999
|
||||
Node: Readline Interaction343619
|
||||
Node: Readline Bare Essentials344807
|
||||
Node: Readline Movement Commands346593
|
||||
Node: Readline Killing Commands347550
|
||||
Node: Readline Arguments349468
|
||||
Node: Searching350509
|
||||
Node: Readline Init File352692
|
||||
Node: Readline Init File Syntax353950
|
||||
Node: Conditional Init Constructs377738
|
||||
Node: Sample Init File381931
|
||||
Node: Bindable Readline Commands385052
|
||||
Node: Commands For Moving386253
|
||||
Node: Commands For History388301
|
||||
Node: Commands For Text393292
|
||||
Node: Commands For Killing396938
|
||||
Node: Numeric Arguments399968
|
||||
Node: Commands For Completion401104
|
||||
Node: Keyboard Macros405292
|
||||
Node: Miscellaneous Commands405977
|
||||
Node: Readline vi Mode412012
|
||||
Node: Programmable Completion412916
|
||||
Node: Programmable Completion Builtins420693
|
||||
Node: A Programmable Completion Example431442
|
||||
Node: Using History Interactively436687
|
||||
Node: Bash History Facilities437368
|
||||
Node: Bash History Builtins440370
|
||||
Node: History Interaction445391
|
||||
Node: Event Designators449008
|
||||
Node: Word Designators450359
|
||||
Node: Modifiers452116
|
||||
Node: Installing Bash453921
|
||||
Node: Basic Installation455055
|
||||
Node: Compilers and Options458774
|
||||
Node: Compiling For Multiple Architectures459512
|
||||
Node: Installation Names461201
|
||||
Node: Specifying the System Type463307
|
||||
Node: Sharing Defaults464021
|
||||
Node: Operation Controls464691
|
||||
Node: Optional Features465646
|
||||
Node: Reporting Bugs476862
|
||||
Node: Major Differences From The Bourne Shell478193
|
||||
Node: GNU Free Documentation License495039
|
||||
Node: Indexes520213
|
||||
Node: Builtin Index520664
|
||||
Node: Reserved Word Index527488
|
||||
Node: Variable Index529933
|
||||
Node: Function Index546918
|
||||
Node: Concept Index560699
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
+265
-174
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 6.8 from
|
||||
bashref.texi.
|
||||
|
||||
This text is a brief description of the features that are present in the
|
||||
Bash shell (version 5.2, 14 March 2023).
|
||||
Bash shell (version 5.2, 15 April 2023).
|
||||
|
||||
This is Edition 5.2, last updated 14 March 2023, of 'The GNU Bash
|
||||
This is Edition 5.2, last updated 15 April 2023, of 'The GNU Bash
|
||||
Reference Manual', for 'Bash', Version 5.2.
|
||||
|
||||
Copyright (C) 1988-2023 Free Software Foundation, Inc.
|
||||
@@ -27,10 +27,10 @@ Bash Features
|
||||
*************
|
||||
|
||||
This text is a brief description of the features that are present in the
|
||||
Bash shell (version 5.2, 14 March 2023). The Bash home page is
|
||||
Bash shell (version 5.2, 15 April 2023). The Bash home page is
|
||||
<http://www.gnu.org/software/bash/>.
|
||||
|
||||
This is Edition 5.2, last updated 14 March 2023, of 'The GNU Bash
|
||||
This is Edition 5.2, last updated 15 April 2023, of 'The GNU Bash
|
||||
Reference Manual', for 'Bash', Version 5.2.
|
||||
|
||||
Bash contains features that appear in other popular shells, and some
|
||||
@@ -2410,6 +2410,10 @@ behavior of ignoring filenames beginning with a '.', make '.*' one of
|
||||
the patterns in 'GLOBIGNORE'. The 'dotglob' option is disabled when
|
||||
'GLOBIGNORE' is unset.
|
||||
|
||||
After the pattern is expanded and matched against filenames, the
|
||||
value of the 'GLOBSORT' variable controls how the results are sorted, as
|
||||
described below (*note Bash Variables::).
|
||||
|
||||
|
||||
File: bashref.info, Node: Pattern Matching, Up: Filename Expansion
|
||||
|
||||
@@ -2575,7 +2579,7 @@ was redirected to DIRLIST.
|
||||
|
||||
Bash handles several filenames specially when they are used in
|
||||
redirections, as described in the following table. If the operating
|
||||
system on which Bash is running provides these special files, bash will
|
||||
system on which Bash is running provides these special files, Bash will
|
||||
use them; otherwise it will emulate them internally with the behavior
|
||||
described below.
|
||||
|
||||
@@ -3250,7 +3254,7 @@ standard.
|
||||
than or equal to 1.
|
||||
|
||||
'cd'
|
||||
cd [-L|[-P [-e]] [-@] [DIRECTORY]
|
||||
cd [-L|[-P [-e]]] [-@] [DIRECTORY]
|
||||
|
||||
Change the current working directory to DIRECTORY. If DIRECTORY is
|
||||
not supplied, the value of the 'HOME' shell variable is used. If
|
||||
@@ -4855,7 +4859,7 @@ This builtin allows you to change additional shell optional behavior.
|
||||
words to be completed. This means that dollar signs in
|
||||
variable names that expand to directories will not be quoted;
|
||||
however, any dollar signs appearing in filenames will not be
|
||||
quoted, either. This is active only when bash is using
|
||||
quoted, either. This is active only when Bash is using
|
||||
backslashes to quote completed filenames. This variable is
|
||||
set by default, which is the default Bash behavior in versions
|
||||
through 4.2.
|
||||
@@ -5260,7 +5264,7 @@ Variables::).
|
||||
|
||||
'BASH_ARGC'
|
||||
An array variable whose values are the number of parameters in each
|
||||
frame of the current bash execution call stack. The number of
|
||||
frame of the current Bash execution call stack. The number of
|
||||
parameters to the current subroutine (shell function or script
|
||||
executed with '.' or 'source') is at the top of the stack. When a
|
||||
subroutine is executed, the number of parameters passed is pushed
|
||||
@@ -5273,7 +5277,7 @@ Variables::).
|
||||
|
||||
'BASH_ARGV'
|
||||
An array variable containing all of the parameters in the current
|
||||
bash execution call stack. The final parameter of the last
|
||||
Bash execution call stack. The final parameter of the last
|
||||
subroutine call is at the top of the stack; the first parameter of
|
||||
the initial call is at the bottom. When a subroutine is executed,
|
||||
the parameters supplied are pushed onto 'BASH_ARGV'. The shell
|
||||
@@ -5562,6 +5566,28 @@ Variables::).
|
||||
'GLOBIGNORE', it is removed from the list of matches. The pattern
|
||||
matching honors the setting of the 'extglob' shell option.
|
||||
|
||||
'GLOBSORT'
|
||||
Control how the results of filename expansion are sorted. The
|
||||
value of this variable specifies the sort criteria and sort order
|
||||
for the results of filename expansion. If this variable is unset
|
||||
or set to the null string, filename expansion uses the historial
|
||||
behavior of sorting by name. If set, a valid value begins with an
|
||||
optional '+', which is ignored, or '-', which reverses the sort
|
||||
order from ascending to descending, followed by a sort specifier.
|
||||
The valid sort specifiers are 'name', 'size', 'mtime', 'atime',
|
||||
'ctime', and 'blocks', which sort the files on name, file size,
|
||||
modification time, access time, inode change time, and number of
|
||||
blocks, respectively.
|
||||
|
||||
For example, a value of '-mtime' sorts the results in descending
|
||||
order by modification time (newest first).
|
||||
|
||||
If the sort specifier is missing, it defaults to NAME, so a value
|
||||
of '+' is equivalent to the null string, and a value of '-' sorts
|
||||
by name in descending order.
|
||||
|
||||
Any invalid value restores the historical sorting behavior.
|
||||
|
||||
'GROUPS'
|
||||
An array variable containing the list of groups of which the
|
||||
current user is a member. Assignments to 'GROUPS' have no effect.
|
||||
@@ -6574,7 +6600,7 @@ decreasing precedence.
|
||||
'||'
|
||||
logical OR
|
||||
|
||||
'expr ? expr : expr'
|
||||
'expr ? if-true-expr : if-false-expr'
|
||||
conditional operator
|
||||
|
||||
'= *= /= %= += -= <<= >>= &= ^= |='
|
||||
@@ -7070,13 +7096,60 @@ environment, such as 'jails', 'zones', or 'containers'.
|
||||
|
||||
File: bashref.info, Node: Bash POSIX Mode, Next: Shell Compatibility Mode, Prev: The Restricted Shell, Up: Bash Features
|
||||
|
||||
6.11 Bash POSIX Mode
|
||||
====================
|
||||
6.11 Bash and POSIX
|
||||
===================
|
||||
|
||||
Starting Bash with the '--posix' command-line option or executing 'set
|
||||
-o posix' while Bash is running will cause Bash to conform more closely
|
||||
to the POSIX standard by changing the behavior to match that specified
|
||||
by POSIX in areas where the Bash default differs.
|
||||
6.11.1 What is POSIX?
|
||||
---------------------
|
||||
|
||||
POSIX is the name for a family of standards based on Unix. A number of
|
||||
Unix services, tools, and functions are part of the standard, ranging
|
||||
from the basic system calls and C library functions to common
|
||||
applications and tools to system administration and management.
|
||||
|
||||
The POSIX Shell and Utilities standard was originally developed by
|
||||
IEEE Working Group 1003.2 (POSIX.2). The first edition of the 1003.2
|
||||
standard was published in 1992. It was merged with the original IEEE
|
||||
1003.1 Working Group and is currently maintained by the Austin Group (a
|
||||
joint working group of the IEEE, The Open Group and ISO/IEC SC22/WG15).
|
||||
Today the Shell and Utilities are a volume within the set of documents
|
||||
that make up IEEE Std 1003.1-2017, and thus the former POSIX.2 (from
|
||||
1992) is now part of the current unified POSIX standard.
|
||||
|
||||
The Shell and Utilities volume concentrates on the command
|
||||
interpreter interface and utility programs commonly executed from the
|
||||
command line or by other programs. The standard is freely available on
|
||||
the web at
|
||||
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html>.
|
||||
|
||||
Bash is concerned with the aspects of the shell's behavior defined by
|
||||
the POSIX Shell and Utilities volume. The shell command language has of
|
||||
course been standardized, including the basic flow control and program
|
||||
execution constructs, I/O redirection and pipelines, argument handling,
|
||||
variable expansion, and quoting.
|
||||
|
||||
The special builtins, which must be implemented as part of the shell
|
||||
to provide the desired functionality, are specified as being part of the
|
||||
shell; examples of these are 'eval' and 'export'. Other utilities
|
||||
appear in the sections of POSIX not devoted to the shell which are
|
||||
commonly (and in some cases must be) implemented as builtin commands,
|
||||
such as 'read' and 'test'. POSIX also specifies aspects of the shell's
|
||||
interactive behavior, including job control and command line editing.
|
||||
Only vi-style line editing commands have been standardized; emacs
|
||||
editing commands were left out due to objections.
|
||||
|
||||
6.11.2 Bash POSIX Mode
|
||||
----------------------
|
||||
|
||||
Although Bash is an implementation of the POSIX shell specification,
|
||||
there are areas where the Bash default behavior differs from the
|
||||
specification. The Bash "posix mode" changes the Bash behavior in these
|
||||
areas so that it conforms to the standard more closely.
|
||||
|
||||
Starting Bash with the '--posix' command-line option or executing
|
||||
'set -o posix' while Bash is running will cause Bash to conform more
|
||||
closely to the POSIX standard by changing the behavior to match that
|
||||
specified by POSIX in areas where the Bash default differs.
|
||||
|
||||
When invoked as 'sh', Bash enters POSIX mode after reading the
|
||||
startup files.
|
||||
@@ -7339,6 +7412,13 @@ startup files.
|
||||
that a backslash preceding a double quote character will escape it
|
||||
and the backslash will be removed.
|
||||
|
||||
66. Command substitutions don't set the '?' special parameter. The
|
||||
exit status of a simple command without a command word is still the
|
||||
exit status of the last command substitution that occurred while
|
||||
evaluating the variable assignments and redirections in that
|
||||
command, but that does not happen until after all of the
|
||||
assignments and redirections.
|
||||
|
||||
There is other POSIX behavior that Bash does not implement by default
|
||||
even when in POSIX mode. Specifically:
|
||||
|
||||
@@ -7346,7 +7426,11 @@ even when in POSIX mode. Specifically:
|
||||
entries if 'FCEDIT' is unset, rather than defaulting directly to
|
||||
'ed'. 'fc' uses 'ed' if 'EDITOR' is unset.
|
||||
|
||||
2. As noted above, Bash requires the 'xpg_echo' option to be enabled
|
||||
2. A non-interactive shell does not exit if a variable assignment
|
||||
preceding the 'command' builtin or another non-special builtin
|
||||
fails.
|
||||
|
||||
3. As noted above, Bash requires the 'xpg_echo' option to be enabled
|
||||
for the 'echo' builtin to be fully conformant.
|
||||
|
||||
Bash can be configured to be POSIX-conformant by default, by
|
||||
@@ -10486,7 +10570,7 @@ at the Bash prompt in your Bash source directory.
|
||||
If you want to build Bash in a directory separate from the source
|
||||
directory - to build for multiple architectures, for example - just use
|
||||
the full path to the configure script. The following commands will
|
||||
build bash in a directory under '/usr/local/build' from the source code
|
||||
build Bash in a directory under '/usr/local/build' from the source code
|
||||
in '/usr/local/src/bash-4.4':
|
||||
|
||||
mkdir /usr/local/build/bash-4.4
|
||||
@@ -10579,7 +10663,7 @@ By default, 'make install' will install into '/usr/local/bin',
|
||||
specifying a value for the 'prefix' 'make' variable when running 'make
|
||||
install' (e.g., 'make install prefix=PATH'). The 'prefix' variable
|
||||
provides a default for 'exec_prefix' and other variables used when
|
||||
installing bash.
|
||||
installing Bash.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
@@ -10592,7 +10676,7 @@ run, you can specify these variables as arguments to 'make': 'make
|
||||
install exec_prefix=/' will install 'bash' and 'bashbug' into '/bin'
|
||||
instead of the default '/usr/local/bin'.
|
||||
|
||||
If you want to see the files bash will install and where it will
|
||||
If you want to see the files Bash will install and where it will
|
||||
install them without changing anything on your system, specify the
|
||||
variable 'DESTDIR' as an argument to 'make'. Its value should be the
|
||||
absolute directory path you'd like to use as the root of your sample
|
||||
@@ -10774,7 +10858,7 @@ does not provide the necessary support.
|
||||
builtins (*note Aliases::).
|
||||
|
||||
'--enable-alt-array-implementation'
|
||||
This builds bash using an alternate implementation of arrays (*note
|
||||
This builds Bash using an alternate implementation of arrays (*note
|
||||
Arrays::) that provides faster access at the expense of using more
|
||||
memory (sometimes many times more, depending on how sparse an array
|
||||
is).
|
||||
@@ -10825,7 +10909,7 @@ does not provide the necessary support.
|
||||
(*note Pipelines::).
|
||||
|
||||
'--enable-debugger'
|
||||
Include support for the bash debugger (distributed separately).
|
||||
Include support for the Bash debugger (distributed separately).
|
||||
|
||||
'--enable-dev-fd-stat-broken'
|
||||
If calling 'stat' on /dev/fd/N returns different results than
|
||||
@@ -10963,11 +11047,11 @@ of Bash. The latest version of Bash is always available for FTP from
|
||||
<http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-master.tar.gz>.
|
||||
|
||||
Once you have determined that a bug actually exists, use the
|
||||
'bashbug' command to submit a bug report or use the form at the <a
|
||||
href="https://savannah.gnu.org/projects/bash/">Bash project page</a>.
|
||||
If you have a fix, you are encouraged to submit that as well!
|
||||
Suggestions and 'philosophical' bug reports may be mailed to
|
||||
<bug-bash@gnu.org> or <help-bash@gnu.org>.
|
||||
'bashbug' command to submit a bug report or use the form at the Bash
|
||||
project page (https://savannah.gnu.org/projects/bash/). If you have a
|
||||
fix, you are encouraged to submit that as well! Suggestions and
|
||||
'philosophical' bug reports may be mailed to <bug-bash@gnu.org> or
|
||||
<help-bash@gnu.org>.
|
||||
|
||||
All bug reports should include:
|
||||
* The version number of Bash.
|
||||
@@ -12111,57 +12195,58 @@ D.3 Parameter and Variable Index
|
||||
* FUNCNAME: Bash Variables. (line 326)
|
||||
* FUNCNEST: Bash Variables. (line 343)
|
||||
* GLOBIGNORE: Bash Variables. (line 348)
|
||||
* GROUPS: Bash Variables. (line 355)
|
||||
* histchars: Bash Variables. (line 361)
|
||||
* HISTCMD: Bash Variables. (line 376)
|
||||
* HISTCONTROL: Bash Variables. (line 382)
|
||||
* HISTFILE: Bash Variables. (line 398)
|
||||
* HISTFILESIZE: Bash Variables. (line 402)
|
||||
* HISTIGNORE: Bash Variables. (line 413)
|
||||
* GLOBSORT: Bash Variables. (line 355)
|
||||
* GROUPS: Bash Variables. (line 377)
|
||||
* histchars: Bash Variables. (line 383)
|
||||
* HISTCMD: Bash Variables. (line 398)
|
||||
* HISTCONTROL: Bash Variables. (line 404)
|
||||
* HISTFILE: Bash Variables. (line 420)
|
||||
* HISTFILESIZE: Bash Variables. (line 424)
|
||||
* HISTIGNORE: Bash Variables. (line 435)
|
||||
* history-preserve-point: Readline Init File Syntax.
|
||||
(line 211)
|
||||
* history-size: Readline Init File Syntax.
|
||||
(line 217)
|
||||
* HISTSIZE: Bash Variables. (line 433)
|
||||
* HISTTIMEFORMAT: Bash Variables. (line 440)
|
||||
* HISTSIZE: Bash Variables. (line 455)
|
||||
* HISTTIMEFORMAT: Bash Variables. (line 462)
|
||||
* HOME: Bourne Shell Variables.
|
||||
(line 13)
|
||||
* horizontal-scroll-mode: Readline Init File Syntax.
|
||||
(line 226)
|
||||
* HOSTFILE: Bash Variables. (line 448)
|
||||
* HOSTNAME: Bash Variables. (line 459)
|
||||
* HOSTTYPE: Bash Variables. (line 462)
|
||||
* HOSTFILE: Bash Variables. (line 470)
|
||||
* HOSTNAME: Bash Variables. (line 481)
|
||||
* HOSTTYPE: Bash Variables. (line 484)
|
||||
* IFS: Bourne Shell Variables.
|
||||
(line 18)
|
||||
* IGNOREEOF: Bash Variables. (line 465)
|
||||
* IGNOREEOF: Bash Variables. (line 487)
|
||||
* input-meta: Readline Init File Syntax.
|
||||
(line 235)
|
||||
* INPUTRC: Bash Variables. (line 475)
|
||||
* INSIDE_EMACS: Bash Variables. (line 479)
|
||||
* INPUTRC: Bash Variables. (line 497)
|
||||
* INSIDE_EMACS: Bash Variables. (line 501)
|
||||
* isearch-terminators: Readline Init File Syntax.
|
||||
(line 245)
|
||||
* keymap: Readline Init File Syntax.
|
||||
(line 252)
|
||||
* LANG: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* LANG <1>: Bash Variables. (line 485)
|
||||
* LC_ALL: Bash Variables. (line 489)
|
||||
* LC_COLLATE: Bash Variables. (line 493)
|
||||
* LC_CTYPE: Bash Variables. (line 500)
|
||||
* LANG <1>: Bash Variables. (line 507)
|
||||
* LC_ALL: Bash Variables. (line 511)
|
||||
* LC_COLLATE: Bash Variables. (line 515)
|
||||
* LC_CTYPE: Bash Variables. (line 522)
|
||||
* LC_MESSAGES: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* LC_MESSAGES <1>: Bash Variables. (line 505)
|
||||
* LC_NUMERIC: Bash Variables. (line 509)
|
||||
* LC_TIME: Bash Variables. (line 513)
|
||||
* LINENO: Bash Variables. (line 517)
|
||||
* LINES: Bash Variables. (line 522)
|
||||
* MACHTYPE: Bash Variables. (line 528)
|
||||
* LC_MESSAGES <1>: Bash Variables. (line 527)
|
||||
* LC_NUMERIC: Bash Variables. (line 531)
|
||||
* LC_TIME: Bash Variables. (line 535)
|
||||
* LINENO: Bash Variables. (line 539)
|
||||
* LINES: Bash Variables. (line 544)
|
||||
* MACHTYPE: Bash Variables. (line 550)
|
||||
* MAIL: Bourne Shell Variables.
|
||||
(line 22)
|
||||
* MAILCHECK: Bash Variables. (line 532)
|
||||
* MAILCHECK: Bash Variables. (line 554)
|
||||
* MAILPATH: Bourne Shell Variables.
|
||||
(line 27)
|
||||
* MAPFILE: Bash Variables. (line 540)
|
||||
* MAPFILE: Bash Variables. (line 562)
|
||||
* mark-modified-lines: Readline Init File Syntax.
|
||||
(line 282)
|
||||
* mark-symlinked-directories: Readline Init File Syntax.
|
||||
@@ -12172,46 +12257,46 @@ D.3 Parameter and Variable Index
|
||||
(line 299)
|
||||
* meta-flag: Readline Init File Syntax.
|
||||
(line 235)
|
||||
* OLDPWD: Bash Variables. (line 544)
|
||||
* OLDPWD: Bash Variables. (line 566)
|
||||
* OPTARG: Bourne Shell Variables.
|
||||
(line 34)
|
||||
* OPTERR: Bash Variables. (line 547)
|
||||
* OPTERR: Bash Variables. (line 569)
|
||||
* OPTIND: Bourne Shell Variables.
|
||||
(line 38)
|
||||
* OSTYPE: Bash Variables. (line 551)
|
||||
* OSTYPE: Bash Variables. (line 573)
|
||||
* output-meta: Readline Init File Syntax.
|
||||
(line 304)
|
||||
* page-completions: Readline Init File Syntax.
|
||||
(line 312)
|
||||
* PATH: Bourne Shell Variables.
|
||||
(line 42)
|
||||
* PIPESTATUS: Bash Variables. (line 554)
|
||||
* POSIXLY_CORRECT: Bash Variables. (line 559)
|
||||
* PPID: Bash Variables. (line 569)
|
||||
* PROMPT_COMMAND: Bash Variables. (line 573)
|
||||
* PROMPT_DIRTRIM: Bash Variables. (line 579)
|
||||
* PS0: Bash Variables. (line 585)
|
||||
* PIPESTATUS: Bash Variables. (line 576)
|
||||
* POSIXLY_CORRECT: Bash Variables. (line 581)
|
||||
* PPID: Bash Variables. (line 591)
|
||||
* PROMPT_COMMAND: Bash Variables. (line 595)
|
||||
* PROMPT_DIRTRIM: Bash Variables. (line 601)
|
||||
* PS0: Bash Variables. (line 607)
|
||||
* PS1: Bourne Shell Variables.
|
||||
(line 48)
|
||||
* PS2: Bourne Shell Variables.
|
||||
(line 53)
|
||||
* PS3: Bash Variables. (line 590)
|
||||
* PS4: Bash Variables. (line 595)
|
||||
* PWD: Bash Variables. (line 603)
|
||||
* RANDOM: Bash Variables. (line 606)
|
||||
* READLINE_ARGUMENT: Bash Variables. (line 612)
|
||||
* READLINE_LINE: Bash Variables. (line 616)
|
||||
* READLINE_MARK: Bash Variables. (line 620)
|
||||
* READLINE_POINT: Bash Variables. (line 626)
|
||||
* REPLY: Bash Variables. (line 630)
|
||||
* PS3: Bash Variables. (line 612)
|
||||
* PS4: Bash Variables. (line 617)
|
||||
* PWD: Bash Variables. (line 625)
|
||||
* RANDOM: Bash Variables. (line 628)
|
||||
* READLINE_ARGUMENT: Bash Variables. (line 634)
|
||||
* READLINE_LINE: Bash Variables. (line 638)
|
||||
* READLINE_MARK: Bash Variables. (line 642)
|
||||
* READLINE_POINT: Bash Variables. (line 648)
|
||||
* REPLY: Bash Variables. (line 652)
|
||||
* revert-all-at-newline: Readline Init File Syntax.
|
||||
(line 322)
|
||||
* search-ignore-case: Readline Init File Syntax.
|
||||
(line 329)
|
||||
* SECONDS: Bash Variables. (line 633)
|
||||
* SHELL: Bash Variables. (line 642)
|
||||
* SHELLOPTS: Bash Variables. (line 647)
|
||||
* SHLVL: Bash Variables. (line 656)
|
||||
* SECONDS: Bash Variables. (line 655)
|
||||
* SHELL: Bash Variables. (line 664)
|
||||
* SHELLOPTS: Bash Variables. (line 669)
|
||||
* SHLVL: Bash Variables. (line 678)
|
||||
* show-all-if-ambiguous: Readline Init File Syntax.
|
||||
(line 334)
|
||||
* show-all-if-unmodified: Readline Init File Syntax.
|
||||
@@ -12220,15 +12305,15 @@ D.3 Parameter and Variable Index
|
||||
(line 349)
|
||||
* skip-completed-text: Readline Init File Syntax.
|
||||
(line 355)
|
||||
* SRANDOM: Bash Variables. (line 661)
|
||||
* SRANDOM: Bash Variables. (line 683)
|
||||
* TEXTDOMAIN: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* TEXTDOMAINDIR: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* TIMEFORMAT: Bash Variables. (line 670)
|
||||
* TMOUT: Bash Variables. (line 708)
|
||||
* TMPDIR: Bash Variables. (line 720)
|
||||
* UID: Bash Variables. (line 724)
|
||||
* TIMEFORMAT: Bash Variables. (line 692)
|
||||
* TMOUT: Bash Variables. (line 730)
|
||||
* TMPDIR: Bash Variables. (line 742)
|
||||
* UID: Bash Variables. (line 746)
|
||||
* vi-cmd-mode-string: Readline Init File Syntax.
|
||||
(line 368)
|
||||
* vi-ins-mode-string: Readline Init File Syntax.
|
||||
@@ -12455,11 +12540,14 @@ D.5 Concept Index
|
||||
* arithmetic evaluation: Shell Arithmetic. (line 6)
|
||||
* arithmetic expansion: Arithmetic Expansion.
|
||||
(line 6)
|
||||
* arithmetic operators: Shell Arithmetic. (line 17)
|
||||
* arithmetic, shell: Shell Arithmetic. (line 6)
|
||||
* arrays: Arrays. (line 6)
|
||||
* background: Job Control Basics. (line 6)
|
||||
* Bash configuration: Basic Installation. (line 6)
|
||||
* Bash installation: Basic Installation. (line 6)
|
||||
* binary arithmetic operators: Shell Arithmetic. (line 17)
|
||||
* bitwise arithmetic operators: Shell Arithmetic. (line 17)
|
||||
* Bourne shell: Basic Shell Features.
|
||||
(line 6)
|
||||
* brace expansion: Brace Expansion. (line 6)
|
||||
@@ -12493,6 +12581,7 @@ D.5 Concept Index
|
||||
(line 6)
|
||||
* completion builtins: Programmable Completion Builtins.
|
||||
(line 6)
|
||||
* conditional arithmetic operator: Shell Arithmetic. (line 17)
|
||||
* configuration: Basic Installation. (line 6)
|
||||
* control operator: Definitions. (line 21)
|
||||
* coprocess: Coprocesses. (line 6)
|
||||
@@ -12567,7 +12656,8 @@ D.5 Concept Index
|
||||
* pattern matching: Pattern Matching. (line 6)
|
||||
* pipeline: Pipelines. (line 6)
|
||||
* POSIX: Definitions. (line 9)
|
||||
* POSIX Mode: Bash POSIX Mode. (line 6)
|
||||
* POSIX description: Bash POSIX Mode. (line 9)
|
||||
* POSIX Mode: Bash POSIX Mode. (line 48)
|
||||
* process group: Definitions. (line 62)
|
||||
* process group ID: Definitions. (line 66)
|
||||
* process substitution: Process Substitution.
|
||||
@@ -12602,6 +12692,7 @@ D.5 Concept Index
|
||||
* tilde expansion: Tilde Expansion. (line 6)
|
||||
* token: Definitions. (line 86)
|
||||
* translation, native languages: Locale Translation. (line 6)
|
||||
* unary arithmetic operators: Shell Arithmetic. (line 17)
|
||||
* variable, shell: Shell Parameters. (line 6)
|
||||
* variables, readline: Readline Init File Syntax.
|
||||
(line 37)
|
||||
@@ -12653,98 +12744,98 @@ Node: Arithmetic Expansion97756
|
||||
Node: Process Substitution98724
|
||||
Node: Word Splitting99844
|
||||
Node: Filename Expansion101892
|
||||
Node: Pattern Matching104641
|
||||
Node: Quote Removal109643
|
||||
Node: Redirections109938
|
||||
Node: Executing Commands119631
|
||||
Node: Simple Command Expansion120301
|
||||
Node: Command Search and Execution122411
|
||||
Node: Command Execution Environment124798
|
||||
Node: Environment127833
|
||||
Node: Exit Status129496
|
||||
Node: Signals131280
|
||||
Node: Shell Scripts134729
|
||||
Node: Shell Builtin Commands137756
|
||||
Node: Bourne Shell Builtins139794
|
||||
Node: Bash Builtins161992
|
||||
Node: Modifying Shell Behavior193991
|
||||
Node: The Set Builtin194336
|
||||
Node: The Shopt Builtin204934
|
||||
Node: Special Builtins220846
|
||||
Node: Shell Variables221825
|
||||
Node: Bourne Shell Variables222262
|
||||
Node: Bash Variables224366
|
||||
Node: Bash Features257181
|
||||
Node: Invoking Bash258194
|
||||
Node: Bash Startup Files264207
|
||||
Node: Interactive Shells269338
|
||||
Node: What is an Interactive Shell?269749
|
||||
Node: Is this Shell Interactive?270398
|
||||
Node: Interactive Shell Behavior271213
|
||||
Node: Bash Conditional Expressions274842
|
||||
Node: Shell Arithmetic279484
|
||||
Node: Aliases282428
|
||||
Node: Arrays285322
|
||||
Node: The Directory Stack291885
|
||||
Node: Directory Stack Builtins292669
|
||||
Node: Controlling the Prompt296929
|
||||
Node: The Restricted Shell299894
|
||||
Node: Bash POSIX Mode302504
|
||||
Node: Shell Compatibility Mode315370
|
||||
Node: Job Control323937
|
||||
Node: Job Control Basics324397
|
||||
Node: Job Control Builtins329399
|
||||
Node: Job Control Variables335194
|
||||
Node: Command Line Editing336350
|
||||
Node: Introduction and Notation338021
|
||||
Node: Readline Interaction339644
|
||||
Node: Readline Bare Essentials340835
|
||||
Node: Readline Movement Commands342624
|
||||
Node: Readline Killing Commands343584
|
||||
Node: Readline Arguments345505
|
||||
Node: Searching346549
|
||||
Node: Readline Init File348735
|
||||
Node: Readline Init File Syntax349996
|
||||
Node: Conditional Init Constructs373787
|
||||
Node: Sample Init File377983
|
||||
Node: Bindable Readline Commands381107
|
||||
Node: Commands For Moving382311
|
||||
Node: Commands For History384362
|
||||
Node: Commands For Text389356
|
||||
Node: Commands For Killing393005
|
||||
Node: Numeric Arguments396038
|
||||
Node: Commands For Completion397177
|
||||
Node: Keyboard Macros401368
|
||||
Node: Miscellaneous Commands402056
|
||||
Node: Readline vi Mode408094
|
||||
Node: Programmable Completion409001
|
||||
Node: Programmable Completion Builtins416781
|
||||
Node: A Programmable Completion Example427533
|
||||
Node: Using History Interactively432781
|
||||
Node: Bash History Facilities433465
|
||||
Node: Bash History Builtins436470
|
||||
Node: History Interaction441494
|
||||
Node: Event Designators445114
|
||||
Node: Word Designators446468
|
||||
Node: Modifiers448228
|
||||
Node: Installing Bash450036
|
||||
Node: Basic Installation451173
|
||||
Node: Compilers and Options454895
|
||||
Node: Compiling For Multiple Architectures455636
|
||||
Node: Installation Names457328
|
||||
Node: Specifying the System Type459437
|
||||
Node: Sharing Defaults460154
|
||||
Node: Operation Controls460827
|
||||
Node: Optional Features461785
|
||||
Node: Reporting Bugs473004
|
||||
Node: Major Differences From The Bourne Shell474348
|
||||
Node: GNU Free Documentation License491197
|
||||
Node: Indexes516374
|
||||
Node: Builtin Index516828
|
||||
Node: Reserved Word Index523655
|
||||
Node: Variable Index526103
|
||||
Node: Function Index543018
|
||||
Node: Concept Index556802
|
||||
Node: Pattern Matching104825
|
||||
Node: Quote Removal109827
|
||||
Node: Redirections110122
|
||||
Node: Executing Commands119815
|
||||
Node: Simple Command Expansion120485
|
||||
Node: Command Search and Execution122595
|
||||
Node: Command Execution Environment124982
|
||||
Node: Environment128017
|
||||
Node: Exit Status129680
|
||||
Node: Signals131464
|
||||
Node: Shell Scripts134913
|
||||
Node: Shell Builtin Commands137940
|
||||
Node: Bourne Shell Builtins139978
|
||||
Node: Bash Builtins162177
|
||||
Node: Modifying Shell Behavior194176
|
||||
Node: The Set Builtin194521
|
||||
Node: The Shopt Builtin205119
|
||||
Node: Special Builtins221031
|
||||
Node: Shell Variables222010
|
||||
Node: Bourne Shell Variables222447
|
||||
Node: Bash Variables224551
|
||||
Node: Bash Features258467
|
||||
Node: Invoking Bash259480
|
||||
Node: Bash Startup Files265493
|
||||
Node: Interactive Shells270624
|
||||
Node: What is an Interactive Shell?271035
|
||||
Node: Is this Shell Interactive?271684
|
||||
Node: Interactive Shell Behavior272499
|
||||
Node: Bash Conditional Expressions276128
|
||||
Node: Shell Arithmetic280770
|
||||
Node: Aliases283731
|
||||
Node: Arrays286625
|
||||
Node: The Directory Stack293188
|
||||
Node: Directory Stack Builtins293972
|
||||
Node: Controlling the Prompt298232
|
||||
Node: The Restricted Shell301197
|
||||
Node: Bash POSIX Mode303807
|
||||
Node: Shell Compatibility Mode319600
|
||||
Node: Job Control328167
|
||||
Node: Job Control Basics328627
|
||||
Node: Job Control Builtins333629
|
||||
Node: Job Control Variables339424
|
||||
Node: Command Line Editing340580
|
||||
Node: Introduction and Notation342251
|
||||
Node: Readline Interaction343874
|
||||
Node: Readline Bare Essentials345065
|
||||
Node: Readline Movement Commands346854
|
||||
Node: Readline Killing Commands347814
|
||||
Node: Readline Arguments349735
|
||||
Node: Searching350779
|
||||
Node: Readline Init File352965
|
||||
Node: Readline Init File Syntax354226
|
||||
Node: Conditional Init Constructs378017
|
||||
Node: Sample Init File382213
|
||||
Node: Bindable Readline Commands385337
|
||||
Node: Commands For Moving386541
|
||||
Node: Commands For History388592
|
||||
Node: Commands For Text393586
|
||||
Node: Commands For Killing397235
|
||||
Node: Numeric Arguments400268
|
||||
Node: Commands For Completion401407
|
||||
Node: Keyboard Macros405598
|
||||
Node: Miscellaneous Commands406286
|
||||
Node: Readline vi Mode412324
|
||||
Node: Programmable Completion413231
|
||||
Node: Programmable Completion Builtins421011
|
||||
Node: A Programmable Completion Example431763
|
||||
Node: Using History Interactively437011
|
||||
Node: Bash History Facilities437695
|
||||
Node: Bash History Builtins440700
|
||||
Node: History Interaction445724
|
||||
Node: Event Designators449344
|
||||
Node: Word Designators450698
|
||||
Node: Modifiers452458
|
||||
Node: Installing Bash454266
|
||||
Node: Basic Installation455403
|
||||
Node: Compilers and Options459125
|
||||
Node: Compiling For Multiple Architectures459866
|
||||
Node: Installation Names461558
|
||||
Node: Specifying the System Type463667
|
||||
Node: Sharing Defaults464384
|
||||
Node: Operation Controls465057
|
||||
Node: Optional Features466015
|
||||
Node: Reporting Bugs477234
|
||||
Node: Major Differences From The Bourne Shell478568
|
||||
Node: GNU Free Documentation License495417
|
||||
Node: Indexes520594
|
||||
Node: Builtin Index521048
|
||||
Node: Reserved Word Index527875
|
||||
Node: Variable Index530323
|
||||
Node: Function Index547311
|
||||
Node: Concept Index561095
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
@@ -2838,6 +2838,10 @@ To get the old behavior of ignoring filenames beginning with a
|
||||
The @code{dotglob} option is disabled when @env{GLOBIGNORE}
|
||||
is unset.
|
||||
|
||||
After the pattern is expanded and matched against filenames, the value of the
|
||||
@env{GLOBSORT} variable controls how the results are sorted, as described
|
||||
below (@pxref{Bash Variables}).
|
||||
|
||||
@node Pattern Matching
|
||||
@subsubsection Pattern Matching
|
||||
@cindex pattern matching
|
||||
@@ -6467,6 +6471,35 @@ of matches.
|
||||
The pattern matching honors the setting of the @code{extglob} shell
|
||||
option.
|
||||
|
||||
@item GLOBSORT
|
||||
Control how the results of filename expansion are sorted.
|
||||
The value of this variable specifies the sort criteria and sort order for
|
||||
the results of filename expansion.
|
||||
If this variable is unset or set to the null string, filename expansion
|
||||
uses the historial behavior of sorting by name.
|
||||
If set, a valid value begins with an optional @samp{+}, which is ignored,
|
||||
or @samp{-}, which reverses the sort order from ascending to descending,
|
||||
followed by a sort specifier.
|
||||
The valid sort specifiers are
|
||||
@samp{name},
|
||||
@samp{size},
|
||||
@samp{mtime},
|
||||
@samp{atime},
|
||||
@samp{ctime},
|
||||
and
|
||||
@samp{blocks},
|
||||
which sort the files on name, file size, modification time, access time,
|
||||
inode change time, and number of blocks, respectively.
|
||||
|
||||
For example, a value of @code{-mtime} sorts the results in descending
|
||||
order by modification time (newest first).
|
||||
|
||||
If the sort specifier is missing, it defaults to @var{name},
|
||||
so a value of @samp{+} is equivalent to the null string,
|
||||
and a value of @samp{-} sorts by name in descending order.
|
||||
|
||||
Any invalid value restores the historical sorting behavior.
|
||||
|
||||
@item GROUPS
|
||||
An array variable containing the list of groups of which the current
|
||||
user is a member.
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@
|
||||
Copyright (C) 1988-2023 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Thu Apr 6 11:58:41 EDT 2023
|
||||
@set LASTCHANGE Sat Apr 15 17:27:25 EDT 2023
|
||||
|
||||
@set EDITION 5.2
|
||||
@set VERSION 5.2
|
||||
|
||||
@set UPDATED 6 April 2023
|
||||
@set UPDATED 15 April 2023
|
||||
@set UPDATED-MONTH April 2023
|
||||
|
||||
@@ -43,6 +43,11 @@ extern int errno;
|
||||
#define VAL_SSIZE_MAX -1004
|
||||
#define VAL_SIZE_MAX -1005
|
||||
|
||||
/* We don't want to collide with anything else. */
|
||||
#ifndef _CS_PATH
|
||||
#define _CS_PATH -1001
|
||||
#endif
|
||||
|
||||
struct conf
|
||||
{
|
||||
const char *name;
|
||||
@@ -916,6 +921,31 @@ static int getconf_all (void);
|
||||
static int getconf_one (WORD_LIST *);
|
||||
static int getconf_internal (const struct conf *, int);
|
||||
|
||||
#ifndef HAVE_CONFSTR
|
||||
/* If we don't have confstr, this will only support `getconf PATH'. */
|
||||
|
||||
static size_t
|
||||
confstr (int name, char *buf, size_t len)
|
||||
{
|
||||
char *p;
|
||||
size_t n;
|
||||
|
||||
switch (name)
|
||||
{
|
||||
case _CS_PATH:
|
||||
p = conf_standard_path ();
|
||||
n = STRLEN (p) + 1;
|
||||
if (len != 0 && buf != 0)
|
||||
strlcpy (buf, p, len);
|
||||
free (p);
|
||||
return n;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif /* !HAVE_CONFSTR */
|
||||
|
||||
static int
|
||||
getconf_internal (const struct conf *c, int all)
|
||||
{
|
||||
|
||||
@@ -179,6 +179,10 @@ extern void show_shell_version (int);
|
||||
/* Functions from the bash library, lib/sh/libsh.a. These should really
|
||||
go into a separate include file. */
|
||||
|
||||
/* declarations for functions defined in lib/sh/anonfile.c */
|
||||
extern int anonopen (const char *, int);
|
||||
extern int anonclose (int, const char *);
|
||||
|
||||
/* declarations for functions defined in lib/sh/casemod.c */
|
||||
extern char *sh_modcase (const char *, char *, int);
|
||||
|
||||
@@ -496,6 +500,7 @@ extern void print_timeval (FILE *, struct timeval *);
|
||||
#define MT_READWRITE 0x0002
|
||||
#define MT_USERANDOM 0x0004
|
||||
#define MT_TEMPLATE 0x0008
|
||||
#define MT_UNLINK 0x0010 /* unlink after opening */
|
||||
|
||||
extern char *sh_mktmpname (const char *, int);
|
||||
extern int sh_mktmpfd (const char *, int, char **);
|
||||
|
||||
@@ -102,7 +102,7 @@ cc_t old_vtime;
|
||||
struct termios term;
|
||||
|
||||
int
|
||||
main()
|
||||
main(int c, char **v)
|
||||
{
|
||||
fd_set fds;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* fileman.c - file manager example for readline library. */
|
||||
|
||||
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2009,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
@@ -61,24 +61,24 @@
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
|
||||
extern char *xmalloc PARAMS((size_t));
|
||||
extern char *xmalloc (size_t);
|
||||
|
||||
void initialize_readline PARAMS((void));
|
||||
void too_dangerous PARAMS((char *));
|
||||
void initialize_readline (void);
|
||||
void too_dangerous (char *);
|
||||
|
||||
int execute_line PARAMS((char *));
|
||||
int valid_argument PARAMS((char *, char *));
|
||||
int execute_line (char *);
|
||||
int valid_argument (char *, char *);
|
||||
|
||||
/* The names of functions that actually do the manipulation. */
|
||||
int com_list PARAMS((char *));
|
||||
int com_view PARAMS((char *));
|
||||
int com_rename PARAMS((char *));
|
||||
int com_stat PARAMS((char *));
|
||||
int com_pwd PARAMS((char *));
|
||||
int com_delete PARAMS((char *));
|
||||
int com_help PARAMS((char *));
|
||||
int com_cd PARAMS((char *));
|
||||
int com_quit PARAMS((char *));
|
||||
int com_list (char *);
|
||||
int com_view (char *);
|
||||
int com_rename (char *);
|
||||
int com_stat (char *);
|
||||
int com_pwd (char *);
|
||||
int com_delete (char *);
|
||||
int com_help (char *);
|
||||
int com_cd (char *);
|
||||
int com_quit (char *);
|
||||
|
||||
/* A structure which contains information on the commands this program
|
||||
can understand. */
|
||||
@@ -105,8 +105,11 @@ COMMAND commands[] = {
|
||||
};
|
||||
|
||||
/* Forward declarations. */
|
||||
char *stripwhite ();
|
||||
COMMAND *find_command ();
|
||||
char *dupstr (char *);
|
||||
int execute_line (char *);
|
||||
char *stripwhite (char *);
|
||||
|
||||
COMMAND *find_command (char *);
|
||||
|
||||
/* The name of this program, as taken from argv[0]. */
|
||||
char *progname;
|
||||
@@ -115,8 +118,7 @@ char *progname;
|
||||
int done;
|
||||
|
||||
char *
|
||||
dupstr (s)
|
||||
char *s;
|
||||
dupstr (char *s)
|
||||
{
|
||||
char *r;
|
||||
|
||||
@@ -125,45 +127,9 @@ dupstr (s)
|
||||
return (r);
|
||||
}
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *line, *s;
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
initialize_readline (); /* Bind our completer. */
|
||||
|
||||
/* Loop reading and executing lines until the user quits. */
|
||||
for ( ; done == 0; )
|
||||
{
|
||||
line = readline ("FileMan: ");
|
||||
|
||||
if (!line)
|
||||
break;
|
||||
|
||||
/* Remove leading and trailing whitespace from the line.
|
||||
Then, if there is anything left, add it to the history list
|
||||
and execute it. */
|
||||
s = stripwhite (line);
|
||||
|
||||
if (*s)
|
||||
{
|
||||
add_history (s);
|
||||
execute_line (s);
|
||||
}
|
||||
|
||||
free (line);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
|
||||
/* Execute a command line. */
|
||||
int
|
||||
execute_line (line)
|
||||
char *line;
|
||||
execute_line (char *line)
|
||||
{
|
||||
register int i;
|
||||
COMMAND *command;
|
||||
@@ -202,8 +168,7 @@ execute_line (line)
|
||||
/* Look up NAME as the name of a command, and return a pointer to that
|
||||
command. Return a NULL pointer if NAME isn't a command name. */
|
||||
COMMAND *
|
||||
find_command (name)
|
||||
char *name;
|
||||
find_command (char *name)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -217,8 +182,7 @@ find_command (name)
|
||||
/* Strip whitespace from the start and end of STRING. Return a pointer
|
||||
into STRING. */
|
||||
char *
|
||||
stripwhite (string)
|
||||
char *string;
|
||||
stripwhite (char *string)
|
||||
{
|
||||
register char *s, *t;
|
||||
|
||||
@@ -242,14 +206,14 @@ stripwhite (string)
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
char *command_generator PARAMS((const char *, int));
|
||||
char **fileman_completion PARAMS((const char *, int, int));
|
||||
char *command_generator (const char *, int);
|
||||
char **fileman_completion (const char *, int, int);
|
||||
|
||||
/* Tell the GNU Readline library how to complete. We want to try to complete
|
||||
on command names if this is the first word in the line, or on filenames
|
||||
if not. */
|
||||
void
|
||||
initialize_readline ()
|
||||
initialize_readline (void)
|
||||
{
|
||||
/* Allow conditional parsing of the ~/.inputrc file. */
|
||||
rl_readline_name = "FileMan";
|
||||
@@ -264,9 +228,7 @@ initialize_readline ()
|
||||
in case we want to do some simple parsing. Return the array of matches,
|
||||
or NULL if there aren't any. */
|
||||
char **
|
||||
fileman_completion (text, start, end)
|
||||
const char *text;
|
||||
int start, end;
|
||||
fileman_completion (const char *text, int start, int end)
|
||||
{
|
||||
char **matches;
|
||||
|
||||
@@ -285,9 +247,7 @@ fileman_completion (text, start, end)
|
||||
to start from scratch; without any state (i.e. STATE == 0), then we
|
||||
start at the top of the list. */
|
||||
char *
|
||||
command_generator (text, state)
|
||||
const char *text;
|
||||
int state;
|
||||
command_generator (const char *text, int state)
|
||||
{
|
||||
static int list_index, len;
|
||||
char *name;
|
||||
@@ -504,3 +464,36 @@ valid_argument (caller, arg)
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *line, *s;
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
initialize_readline (); /* Bind our completer. */
|
||||
|
||||
/* Loop reading and executing lines until the user quits. */
|
||||
for ( ; done == 0; )
|
||||
{
|
||||
line = readline ("FileMan: ");
|
||||
|
||||
if (!line)
|
||||
break;
|
||||
|
||||
/* Remove leading and trailing whitespace from the line.
|
||||
Then, if there is anything left, add it to the history list
|
||||
and execute it. */
|
||||
s = stripwhite (line);
|
||||
|
||||
if (*s)
|
||||
{
|
||||
add_history (s);
|
||||
execute_line (s);
|
||||
}
|
||||
|
||||
free (line);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* manexamp.c -- The examples which appear in the documentation are here. */
|
||||
|
||||
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2009,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
@@ -18,9 +18,35 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Readline. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if defined (READLINE_LIBRARY)
|
||||
# include "readline.h"
|
||||
# include "history.h"
|
||||
#else
|
||||
# include <readline/readline.h>
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
@@ -33,7 +59,7 @@ static char *line_read = (char *)NULL;
|
||||
|
||||
/* Read a string, and return a pointer to it. Returns NULL on EOF. */
|
||||
char *
|
||||
rl_gets ()
|
||||
rl_gets (void)
|
||||
{
|
||||
/* If the buffer has already been allocated, return the memory
|
||||
to the free pool. */
|
||||
@@ -60,10 +86,11 @@ rl_gets ()
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Invert the case of the COUNT following characters. */
|
||||
invert_case_line (count, key)
|
||||
int count, key;
|
||||
int
|
||||
invert_case_line (int count, int key)
|
||||
{
|
||||
register int start, end;
|
||||
int start, end;
|
||||
int direction;
|
||||
|
||||
start = rl_point;
|
||||
|
||||
@@ -92,7 +119,7 @@ invert_case_line (count, key)
|
||||
}
|
||||
|
||||
if (start == end)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
/* Tell readline that we are modifying the line, so save the undo
|
||||
information. */
|
||||
@@ -108,4 +135,5 @@ invert_case_line (count, key)
|
||||
|
||||
/* Move point to on top of the last character changed. */
|
||||
rl_point = end - direction;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ cb_linehandler (char *line)
|
||||
}
|
||||
|
||||
static char *
|
||||
cb_readline ()
|
||||
cb_readline (void)
|
||||
{
|
||||
fd_set fds;
|
||||
int r, err;
|
||||
@@ -102,15 +102,13 @@ else if (RL_ISSTATE (RL_STATE_NSEARCH))
|
||||
}
|
||||
|
||||
void
|
||||
sigint_sighandler (s)
|
||||
int s;
|
||||
sigint_sighandler (int s)
|
||||
{
|
||||
saw_signal = s;
|
||||
}
|
||||
|
||||
int
|
||||
sigint_handler (s)
|
||||
int s;
|
||||
sigint_handler (int s)
|
||||
{
|
||||
rl_free_line_state ();
|
||||
rl_callback_sigcleanup ();
|
||||
|
||||
@@ -59,7 +59,7 @@ static char *progname;
|
||||
static char *deftext;
|
||||
|
||||
static int
|
||||
set_deftext ()
|
||||
set_deftext (void)
|
||||
{
|
||||
if (deftext)
|
||||
{
|
||||
@@ -71,16 +71,14 @@ set_deftext ()
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n",
|
||||
progname, progname);
|
||||
}
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *temp, *prompt;
|
||||
struct stat sb;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* usage: rlcat
|
||||
*/
|
||||
|
||||
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2009,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
@@ -64,27 +64,26 @@ extern int errno;
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
|
||||
static int stdcat();
|
||||
static int fcopy(FILE *);
|
||||
static int stdcat(int, char **);
|
||||
|
||||
static char *progname;
|
||||
static int vflag;
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
fprintf (stderr, "%s: usage: %s [-vEVN] [filename]\n", progname, progname);
|
||||
}
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *temp;
|
||||
int opt, Vflag, Nflag;
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
setlocale (LC_ALL, ""):
|
||||
setlocale (LC_ALL, "");
|
||||
#endif
|
||||
|
||||
progname = strrchr(argv[0], '/');
|
||||
@@ -134,8 +133,7 @@ main (argc, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
fcopy(fp)
|
||||
FILE *fp;
|
||||
fcopy(FILE *fp)
|
||||
{
|
||||
int c;
|
||||
char *x;
|
||||
@@ -155,9 +153,7 @@ fcopy(fp)
|
||||
}
|
||||
|
||||
int
|
||||
stdcat (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
stdcat (int argc, char **argv)
|
||||
{
|
||||
int i, fd, r;
|
||||
char *s;
|
||||
|
||||
@@ -42,8 +42,7 @@ static int masterfd = -1;
|
||||
static int slavefd;
|
||||
|
||||
void
|
||||
sigint (s)
|
||||
int s;
|
||||
sigint (int s)
|
||||
{
|
||||
tty_reset (STDIN_FILENO);
|
||||
close (masterfd);
|
||||
@@ -53,14 +52,13 @@ sigint (s)
|
||||
}
|
||||
|
||||
void
|
||||
sigwinch (s)
|
||||
int s;
|
||||
sigwinch (int s)
|
||||
{
|
||||
rl_resize_terminal ();
|
||||
}
|
||||
|
||||
static int
|
||||
user_input()
|
||||
user_input(void)
|
||||
{
|
||||
int size;
|
||||
const int MAX = 1024;
|
||||
@@ -78,7 +76,7 @@ user_input()
|
||||
}
|
||||
|
||||
static int
|
||||
readline_input()
|
||||
readline_input(void)
|
||||
{
|
||||
const int MAX = 1024;
|
||||
char *buf = (char *)malloc(MAX+1);
|
||||
@@ -124,7 +122,7 @@ rlctx_send_user_command(char *line)
|
||||
}
|
||||
|
||||
static void
|
||||
custom_deprep_term_function ()
|
||||
custom_deprep_term_function (void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -226,9 +224,10 @@ static enum { RESET, TCBREAK } ttystate = RESET;
|
||||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int tty_cbreak(int fd){
|
||||
int tty_cbreak(int fd)
|
||||
{
|
||||
struct termios buf;
|
||||
int ttysavefd = -1;
|
||||
int ttysavefd = -1;
|
||||
|
||||
if(tcgetattr(fd, &save_termios) < 0)
|
||||
return -1;
|
||||
@@ -316,7 +315,7 @@ int tty_reset(int fd)
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
main(int c, char **v)
|
||||
{
|
||||
int val;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2009,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
@@ -48,10 +48,8 @@ extern void exit();
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
|
||||
extern HIST_ENTRY **history_list ();
|
||||
|
||||
int
|
||||
main ()
|
||||
main (int c, char **v)
|
||||
{
|
||||
char *temp, *prompt;
|
||||
int done;
|
||||
|
||||
+28
-2
@@ -94,7 +94,8 @@ CSOURCES = clktck.c clock.c getcwd.c getenv.c oslib.c setlinebuf.c \
|
||||
wcsdup.c fpurge.c zgetline.c mbscmp.c mbsncmp.c uconvert.c \
|
||||
ufuncs.c casemod.c dprintf.c input_avail.c mbscasecmp.c fnxform.c \
|
||||
strchrnul.c unicode.c wcswidth.c wcsnwidth.c shmbchar.c strdup.c \
|
||||
strvis.c utf8.c random.c gettimeofday.c timers.c
|
||||
strvis.c strlcpy.c strscpy.c utf8.c random.c gettimeofday.c \
|
||||
timers.c anonfile.c
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES =
|
||||
@@ -109,6 +110,7 @@ OBJECTS = clktck.o clock.o getenv.o oslib.o setlinebuf.o strnlen.o \
|
||||
fmtullong.o fmtumax.o zcatfd.o zmapfd.o winsize.o wcsdup.o \
|
||||
fpurge.o zgetline.o mbscmp.o mbsncmp.o uconvert.o ufuncs.o casemod.o \
|
||||
input_avail.o mbscasecmp.o fnxform.o unicode.o shmbchar.o strvis.o \
|
||||
strscpy.o anonfile.o \
|
||||
utf8.o random.o gettimeofday.o timers.o wcsnwidth.o ${LIBOBJS}
|
||||
|
||||
SUPPORT = Makefile
|
||||
@@ -144,6 +146,7 @@ ${BUILD_DIR}/pathnames.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
|
||||
-( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} pathnames.h )
|
||||
|
||||
# rules for losing makes, like SunOS
|
||||
anonfile.o: anonfile.c
|
||||
casemod.o: casemod.c
|
||||
clktck.o: clktck.c
|
||||
clock.o: clock.c
|
||||
@@ -200,6 +203,8 @@ strtoull.o: strtoull.c
|
||||
strtoumax.o: strtoumax.c
|
||||
strtrans.o: strtrans.c
|
||||
strvis.o: strvis.c
|
||||
strlcpy.o: strlcpy.c
|
||||
strscpy.o: strscpy.c
|
||||
timers.o: timers.c
|
||||
times.o: times.c
|
||||
timeval.o: timeval.c
|
||||
@@ -227,6 +232,7 @@ strtoul.o: strtol.c
|
||||
strtoull.o: strtol.c
|
||||
|
||||
# all files in the library depend on config.h
|
||||
anonfile.o: ${BUILD_DIR}/config.h
|
||||
casemod.o: ${BUILD_DIR}/config.h
|
||||
clktck.o: ${BUILD_DIR}/config.h
|
||||
clock.o: ${BUILD_DIR}/config.h
|
||||
@@ -283,6 +289,8 @@ strtoull.o: ${BUILD_DIR}/config.h
|
||||
strtoumax.o: ${BUILD_DIR}/config.h
|
||||
strtrans.o: ${BUILD_DIR}/config.h
|
||||
strvis.o: ${BUILD_DIR}/config.h
|
||||
strlcpy.o: ${BUILD_DIR}/config.h
|
||||
strscpy.o: ${BUILD_DIR}/config.h
|
||||
timers.o: ${BUILD_DIR}/config.h
|
||||
times.o: ${BUILD_DIR}/config.h
|
||||
timeval.o: ${BUILD_DIR}/config.h
|
||||
@@ -521,6 +529,14 @@ strvis.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strvis.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
|
||||
strvis.o: ${topdir}/bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
|
||||
|
||||
strlcpy.o: ${topdir}/bashansi.h
|
||||
strlcpy.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strlcpy.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
strscpy.o: ${topdir}/bashansi.h
|
||||
strscpy.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strscpy.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
times.o: ${BASHINCDIR}/systimes.h
|
||||
times.o: ${BASHINCDIR}/posixtime.h
|
||||
|
||||
@@ -539,7 +555,6 @@ tmpfile.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
tmpfile.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
tmpfile.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
|
||||
uconvert.o: ${topdir}/bashtypes.h
|
||||
uconvert.o: ${BASHINCDIR}/chartypes.h
|
||||
uconvert.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
uconvert.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
@@ -662,3 +677,14 @@ zmapfd.o: ${BASHINCDIR}/stdc.h
|
||||
zmapfd.o: ${topdir}/command.h
|
||||
zmapfd.o: ${topdir}/general.h
|
||||
zmapfd.o: ${topdir}/bashtypes.h ${BASHINCDIR}/chartypes.h ${topdir}/xmalloc.h
|
||||
|
||||
anonfile.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
anonfile.o: ${topdir}/bashtypes.h
|
||||
anonfile.o: ${BASHINCDIR}/filecntl.h
|
||||
anonfile.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
anonfile.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
anonfile.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
anonfile.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
anonfile.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
anonfile.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
anonfile.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/* anonfile.c - open and close temporary files (anonymous and memory-backed if possible). */
|
||||
|
||||
/* Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <bashtypes.h>
|
||||
|
||||
#if defined (HAVE_MEMFD_CREATE) || defined (HAVE_SHM_OPEN) || defined (HAVE_SHM_MKSTEMP)
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
#include <filecntl.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <shell.h>
|
||||
#include <bashansi.h>
|
||||
|
||||
/* Placeholder for future use of memfd_create/shm_open/shm_mkstemp */
|
||||
|
||||
static int
|
||||
anonunlink (const char *fn)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = unlink (fn);
|
||||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
anonopen (const char *name, int flags)
|
||||
{
|
||||
int fd, flag;
|
||||
|
||||
/* Heuristic */
|
||||
flag = (name && *name == '/') ? MT_TEMPLATE : MT_USETMPDIR;
|
||||
fd = sh_mktmpfd (name, flag|MT_USERANDOM|MT_READWRITE|MT_UNLINK, (char **)NULL);
|
||||
return fd;
|
||||
}
|
||||
|
||||
int
|
||||
anonclose (int fd, const char *name)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = close (fd);
|
||||
return r;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/* strlcpy - null-terminated string copy with length checking. */
|
||||
|
||||
/* Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <bashansi.h>
|
||||
|
||||
size_t
|
||||
strlcpy(const char *dest, const const char *src, size_t size)
|
||||
{
|
||||
size_t ret;
|
||||
|
||||
ret = strlen(src);
|
||||
if (size)
|
||||
{
|
||||
size_t len;
|
||||
len = (ret >= size) ? size - 1 : ret;
|
||||
memcpy (dest, src, len);
|
||||
dest[len] = '\0';
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/* strscpy - null-terminated string copy with length checking. */
|
||||
|
||||
/* Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <bashansi.h>
|
||||
|
||||
ssize_t
|
||||
strscpy (char *d, const char *s, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
if ((d[i] = s[i]) == 0)
|
||||
return ((ssize_t)i);
|
||||
|
||||
if (i != 0)
|
||||
d[--i] = '\0';
|
||||
|
||||
return (-1); /* strlen (s) > len */
|
||||
}
|
||||
+34
-4
@@ -58,6 +58,8 @@ extern int errno;
|
||||
|
||||
extern pid_t dollar_dollar_pid;
|
||||
|
||||
static int tmpunlink (const char *);
|
||||
|
||||
static char *get_sys_tmpdir (void);
|
||||
static char *get_tmpdir (int);
|
||||
|
||||
@@ -134,6 +136,15 @@ sh_seedrand (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
tmpunlink (const char *fn)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = unlink (fn);
|
||||
return r;
|
||||
}
|
||||
|
||||
char *
|
||||
sh_mktmpname (const char *nameroot, int flags)
|
||||
{
|
||||
@@ -181,7 +192,7 @@ sh_mktmpname (const char *nameroot, int flags)
|
||||
(unsigned long) dollar_dollar_pid ^
|
||||
x;
|
||||
sprintf (filename, "%s/%s-%lu", tdir, lroot, filenum);
|
||||
if (tmpnamelen > 0 && tmpnamelen < 32)
|
||||
if (tmpnamelen > 0 && tmpnamelen < 32) /* XXX */
|
||||
filename[tdlen + 1 + tmpnamelen] = '\0';
|
||||
# ifdef HAVE_LSTAT
|
||||
r = lstat (filename, &sb);
|
||||
@@ -220,6 +231,13 @@ sh_mktmpfd (const char *nameroot, int flags, char **namep)
|
||||
else
|
||||
sprintf (filename, "%s/%s.XXXXXX", tdir, lroot);
|
||||
fd = mkstemp (filename);
|
||||
if ((flags & MT_UNLINK) && tmpunlink (filename) < 0)
|
||||
{
|
||||
int e = errno;
|
||||
close (fd);
|
||||
fd = -1;
|
||||
errno = e;
|
||||
}
|
||||
if (fd < 0 || namep == 0)
|
||||
{
|
||||
free (filename);
|
||||
@@ -227,6 +245,7 @@ sh_mktmpfd (const char *nameroot, int flags, char **namep)
|
||||
}
|
||||
if (namep)
|
||||
*namep = filename;
|
||||
|
||||
return fd;
|
||||
#else /* !USE_MKSTEMP */
|
||||
#ifndef USE_URANDOM32
|
||||
@@ -245,16 +264,27 @@ sh_mktmpfd (const char *nameroot, int flags, char **namep)
|
||||
(unsigned long) dollar_dollar_pid ^
|
||||
x;
|
||||
sprintf (filename, "%s/%s-%lu", tdir, lroot, filenum);
|
||||
if (tmpnamelen > 0 && tmpnamelen < 32)
|
||||
if (tmpnamelen > 0 && tmpnamelen < 32) /* XXX */
|
||||
filename[tdlen + 1 + tmpnamelen] = '\0';
|
||||
fd = open (filename, BASEOPENFLAGS | ((flags & MT_READWRITE) ? O_RDWR : O_WRONLY), 0600);
|
||||
}
|
||||
while (fd < 0 && errno == EEXIST);
|
||||
|
||||
if ((flags & MT_UNLINK) && (tmpunlink (filename) < 0)
|
||||
{
|
||||
int e = errno;
|
||||
close (fd);
|
||||
fd = -1;
|
||||
errno = e;
|
||||
}
|
||||
if (fd < 0 || namep == 0)
|
||||
{
|
||||
free (filename);
|
||||
filename = NULL;
|
||||
}
|
||||
|
||||
if (namep)
|
||||
*namep = filename;
|
||||
else
|
||||
free (filename);
|
||||
|
||||
return fd;
|
||||
#endif /* !USE_MKSTEMP */
|
||||
|
||||
@@ -381,6 +381,8 @@ static FILE *yyerrstream;
|
||||
|
||||
/* Special; never created by yylex; only set by parse_comsub and xparse_dolparen */
|
||||
%token DOLPAREN
|
||||
/* Special; never created by yylex; only set by parse_matched_pair/parse_comsub/xparse_dolparen */
|
||||
%token DOLBRACE
|
||||
|
||||
/* The types that the various syntactical units return. */
|
||||
|
||||
@@ -1041,6 +1043,14 @@ comsub: DOLPAREN compound_list ')'
|
||||
{
|
||||
$$ = (COMMAND *)NULL;
|
||||
}
|
||||
| DOLBRACE compound_list '}'
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| DOLBRACE newline_list '}'
|
||||
{
|
||||
$$ = (COMMAND *)NULL;
|
||||
}
|
||||
;
|
||||
|
||||
coproc: COPROC shell_command
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "posixstat.h"
|
||||
#include "stat-time.h"
|
||||
|
||||
#include "bashansi.h"
|
||||
|
||||
#include "shell.h"
|
||||
@@ -36,11 +39,13 @@
|
||||
#include "shmbutil.h"
|
||||
#include "bashintl.h"
|
||||
|
||||
|
||||
#include <glob/strmatch.h>
|
||||
|
||||
static int glob_name_is_acceptable (const char *);
|
||||
static void ignore_globbed_names (char **, sh_ignore_func_t *);
|
||||
static char *split_ignorespec (char *, int *);
|
||||
static void sh_sortglob (char **);
|
||||
|
||||
#include <glob/glob.h>
|
||||
|
||||
@@ -396,7 +401,8 @@ quote_globbing_chars (const char *string)
|
||||
return temp;
|
||||
}
|
||||
|
||||
/* Call the glob library to do globbing on PATHNAME. */
|
||||
/* Call the glob library to do globbing on PATHNAME, honoring all the shell
|
||||
variables that control globbing. */
|
||||
char **
|
||||
shell_glob_filename (const char *pathname, int qflags)
|
||||
{
|
||||
@@ -415,7 +421,7 @@ shell_glob_filename (const char *pathname, int qflags)
|
||||
if (should_ignore_glob_matches ())
|
||||
ignore_glob_matches (results);
|
||||
if (results && results[0])
|
||||
strvec_sort (results, 1); /* posix sort */
|
||||
sh_sortglob (results);
|
||||
else
|
||||
{
|
||||
FREE (results);
|
||||
@@ -426,6 +432,28 @@ shell_glob_filename (const char *pathname, int qflags)
|
||||
return (results);
|
||||
}
|
||||
|
||||
#if defined (READLINE) && defined (PROGRAMMABLE_COMPLETION)
|
||||
char **
|
||||
noquote_glob_filename (char *pathname)
|
||||
{
|
||||
char **results;
|
||||
int gflags;
|
||||
|
||||
noglob_dot_filenames = glob_dot_filenames == 0;
|
||||
gflags = glob_star ? GX_GLOBSTAR : 0;
|
||||
|
||||
results = glob_filename (pathname, gflags);
|
||||
|
||||
if (results && GLOB_FAILED (results))
|
||||
results = (char **)NULL;
|
||||
|
||||
if (results && results[0])
|
||||
sh_sortglob (results);
|
||||
|
||||
return (results);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Stuff for GLOBIGNORE. */
|
||||
|
||||
static struct ignorevar globignore =
|
||||
@@ -615,3 +643,210 @@ setup_ignore_patterns (struct ignorevar *ivp)
|
||||
ivp->ignores[numitems].val = (char *)NULL;
|
||||
ivp->num_ignores = numitems;
|
||||
}
|
||||
|
||||
/* Functions to handle sorting glob results in different ways depending on
|
||||
the value of the GLOBSORT variable. */
|
||||
|
||||
static int glob_sorttype = STAT_NONE;
|
||||
|
||||
static STRING_INT_ALIST sorttypes[] = {
|
||||
{ "name", STAT_NAME },
|
||||
{ "size", STAT_SIZE },
|
||||
{ "mtime", STAT_MTIME },
|
||||
{ "atime", STAT_ATIME },
|
||||
{ "ctime", STAT_CTIME },
|
||||
{ "blocks", STAT_BLOCKS },
|
||||
{ (char *)NULL, -1 }
|
||||
};
|
||||
|
||||
/* A subset of the fields in the posix stat struct -- the ones we need --
|
||||
normalized to using struct timespec. */
|
||||
struct globstat {
|
||||
off_t size;
|
||||
struct timespec mtime;
|
||||
struct timespec atime;
|
||||
struct timespec ctime;
|
||||
int blocks;
|
||||
};
|
||||
|
||||
struct globsort_t {
|
||||
char *name;
|
||||
struct globstat st;
|
||||
};
|
||||
|
||||
static struct globstat glob_nullstat = { -1, { -1, -1 }, { -1, -1 }, { -1, -1 }, -1 };
|
||||
|
||||
static inline int
|
||||
glob_findtype (char *t)
|
||||
{
|
||||
int type;
|
||||
|
||||
type = find_string_in_alist (t, sorttypes, 0);
|
||||
return (type == -1 ? STAT_NONE : type);
|
||||
}
|
||||
|
||||
void
|
||||
setup_globsort (const char *varname)
|
||||
{
|
||||
char *val;
|
||||
int r, t;
|
||||
|
||||
glob_sorttype = STAT_NONE;
|
||||
val = get_string_value (varname);
|
||||
if (val == 0 || *val == 0)
|
||||
return;
|
||||
|
||||
t = r = 0;
|
||||
while (*val && whitespace (*val))
|
||||
val++; /* why not? */
|
||||
if (*val == '+')
|
||||
val++; /* allow leading `+' but ignore it */
|
||||
else if (*val == '-')
|
||||
{
|
||||
r = STAT_REVERSE; /* leading `-' reverses sort order */
|
||||
val++;
|
||||
}
|
||||
|
||||
if (*val == 0)
|
||||
{
|
||||
/* A bare `+' means the default sort by name in ascending order; a bare
|
||||
`-' means to sort by name in descending order. */
|
||||
glob_sorttype = STAT_NAME | r;
|
||||
return;
|
||||
}
|
||||
|
||||
t = glob_findtype (val);
|
||||
/* any other value is equivalent to the historical behavior */
|
||||
glob_sorttype = (t == STAT_NONE) ? t : t | r;
|
||||
}
|
||||
|
||||
static int
|
||||
globsort_namecmp (char **s1, char **s2)
|
||||
{
|
||||
return ((glob_sorttype < STAT_REVERSE) ? strvec_posixcmp (s1, s2) : strvec_posixcmp (s2, s1));
|
||||
}
|
||||
|
||||
static int
|
||||
globsort_sizecmp (struct globsort_t *g1, struct globsort_t *g2)
|
||||
{
|
||||
return ((glob_sorttype < STAT_REVERSE) ? g1->st.size - g2->st.size : g2->st.size - g1->st.size);
|
||||
}
|
||||
|
||||
static int
|
||||
globsort_timecmp (struct globsort_t *g1, struct globsort_t *g2)
|
||||
{
|
||||
int t;
|
||||
struct timespec t1, t2;
|
||||
|
||||
t = (glob_sorttype < STAT_REVERSE) ? glob_sorttype : glob_sorttype - STAT_REVERSE;
|
||||
if (t == STAT_MTIME)
|
||||
{
|
||||
t1 = g1->st.mtime;
|
||||
t2 = g2->st.mtime;
|
||||
}
|
||||
else if (t == STAT_ATIME)
|
||||
{
|
||||
t1 = g1->st.atime;
|
||||
t2 = g2->st.atime;
|
||||
}
|
||||
else
|
||||
{
|
||||
t1 = g1->st.ctime;
|
||||
t2 = g2->st.ctime;
|
||||
}
|
||||
|
||||
return ((glob_sorttype < STAT_REVERSE) ? timespec_cmp (t1, t2) : timespec_cmp (t2, t1));
|
||||
}
|
||||
|
||||
static int
|
||||
globsort_blockscmp (struct globsort_t *g1, struct globsort_t *g2)
|
||||
{
|
||||
return ((glob_sorttype < STAT_REVERSE) ? g1->st.blocks - g2->st.blocks : g2->st.blocks - g1->st.blocks);
|
||||
}
|
||||
|
||||
static struct globsort_t *
|
||||
globsort_buildarray (char **array, size_t len)
|
||||
{
|
||||
struct globsort_t *ret;
|
||||
int i;
|
||||
struct stat st;
|
||||
|
||||
ret = (struct globsort_t *)xmalloc (len * sizeof (struct globsort_t));
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
ret[i].name = array[i];
|
||||
if (stat (array[i], &st) != 0)
|
||||
ret[i].st = glob_nullstat;
|
||||
else
|
||||
{
|
||||
ret[i].st.size = st.st_size;
|
||||
ret[i].st.mtime = get_stat_mtime (&st);
|
||||
ret[i].st.atime = get_stat_atime (&st);
|
||||
ret[i].st.ctime = get_stat_ctime (&st);
|
||||
ret[i].st.blocks = st.st_blocks;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void
|
||||
globsort_sortbyname (char **results)
|
||||
{
|
||||
qsort (results, strvec_len (results), sizeof (char *), (QSFUNC *)globsort_namecmp);
|
||||
}
|
||||
|
||||
static void
|
||||
globsort_sortarray (struct globsort_t *garray, size_t len)
|
||||
{
|
||||
int t;
|
||||
QSFUNC *sortfunc;
|
||||
|
||||
t = (glob_sorttype < STAT_REVERSE) ? glob_sorttype : glob_sorttype - STAT_REVERSE;
|
||||
|
||||
switch (t)
|
||||
{
|
||||
case STAT_SIZE:
|
||||
sortfunc = (QSFUNC *)globsort_sizecmp;
|
||||
break;
|
||||
case STAT_ATIME:
|
||||
case STAT_MTIME:
|
||||
case STAT_CTIME:
|
||||
sortfunc = (QSFUNC *)globsort_timecmp;
|
||||
break;
|
||||
case STAT_BLOCKS:
|
||||
sortfunc = (QSFUNC *)globsort_blockscmp;
|
||||
break;
|
||||
default:
|
||||
internal_error (_("invalid glob sort type"));
|
||||
break;
|
||||
}
|
||||
|
||||
qsort (garray, len, sizeof (struct globsort_t), sortfunc);
|
||||
}
|
||||
|
||||
static void
|
||||
sh_sortglob (char **results)
|
||||
{
|
||||
size_t rlen;
|
||||
struct globsort_t *garray;
|
||||
|
||||
if (glob_sorttype == STAT_NONE || glob_sorttype == STAT_NAME)
|
||||
globsort_sortbyname (results); /* posix sort */
|
||||
else if (glob_sorttype == (STAT_NAME|STAT_REVERSE))
|
||||
globsort_sortbyname (results); /* posix sort reverse order */
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
rlen = strvec_len (results);
|
||||
/* populate an array of name/statinfo, sort it appropriately, copy the
|
||||
names from the sorted array back to RESULTS, and free the array */
|
||||
garray = globsort_buildarray (results, rlen);
|
||||
globsort_sortarray (garray, rlen);
|
||||
for (i = 0; i < rlen; i++)
|
||||
results[i] = garray[i].name;
|
||||
free (garray);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ extern char *quote_globbing_chars (const char *);
|
||||
whether or not we've already performed quote removal. */
|
||||
extern char **shell_glob_filename (const char *, int);
|
||||
|
||||
extern char **noquote_glob_filename (char *);
|
||||
|
||||
/* Filename completion ignore. Used to implement the "fignore" facility of
|
||||
tcsh, GLOBIGNORE (like ksh-93 FIGNORE), and EXECIGNORE.
|
||||
|
||||
@@ -102,4 +104,17 @@ extern void setup_glob_ignore (const char *);
|
||||
extern int should_ignore_glob_matches (void);
|
||||
extern void ignore_glob_matches (char **);
|
||||
|
||||
/* Definitions for glob sorting */
|
||||
#define STAT_NONE 0
|
||||
#define STAT_NAME 1
|
||||
#define STAT_SIZE 2
|
||||
#define STAT_MTIME 3
|
||||
#define STAT_ATIME 4
|
||||
#define STAT_CTIME 5
|
||||
#define STAT_BLOCKS 6
|
||||
|
||||
#define STAT_REVERSE 128
|
||||
|
||||
extern void setup_globsort (const char *);
|
||||
|
||||
#endif
|
||||
|
||||
+2
-6
@@ -849,14 +849,9 @@ static STRINGLIST *
|
||||
gen_globpat_matches (COMPSPEC *cs, const char *text)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
int gflags;
|
||||
|
||||
noglob_dot_filenames = glob_dot_filenames == 0;
|
||||
gflags = glob_star ? GX_GLOBSTAR : 0;
|
||||
sl = strlist_create (0);
|
||||
sl->list = glob_filename (cs->globpat, gflags);
|
||||
if (GLOB_FAILED (sl->list))
|
||||
sl->list = (char **)NULL;
|
||||
sl->list = noquote_glob_filename (cs->globpat);
|
||||
if (sl->list)
|
||||
sl->list_len = sl->list_size = strvec_len (sl->list);
|
||||
return sl;
|
||||
@@ -1484,6 +1479,7 @@ pcomp_set_readline_variables (int flags, int nval)
|
||||
option is supposed to turn it off */
|
||||
if (flags & COPT_NOQUOTE)
|
||||
rl_filename_quoting_desired = 1 - nval;
|
||||
/* Ditto */
|
||||
if (flags & COPT_NOSORT)
|
||||
rl_sort_completion_matches = 1 - nval;
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
# This file is distributed under the same license as the bash package.
|
||||
#
|
||||
# Tomislav Krznar <tomislav.krznar@gmail.com>, 2012, 2013.
|
||||
# Božidar Putanec <bozidarp@yahoo.com>, 2018, 2019, 2020, 2021, 2022.
|
||||
# Božidar Putanec <bozidarp@yahoo.com>, 2018, 2019, 2020, 2021, 2022, 2023.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: bash 5.2-rc1\n"
|
||||
"Project-Id-Version: bash-5.2-rc1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-01-11 14:50-0500\n"
|
||||
"PO-Revision-Date: 2022-06-17 11:19-0700\n"
|
||||
"PO-Revision-Date: 2023-04-12 12:19-0700\n"
|
||||
"Last-Translator: Božidar Putanec <bozidarp@yahoo.com>\n"
|
||||
"Language-Team: Croatian <lokalizacija@linux.hr>\n"
|
||||
"Language: hr\n"
|
||||
@@ -18,7 +18,7 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
"X-Bugs: Report translation errors to the Language-Team address.\n"
|
||||
"X-Generator: Lokalize 22.07.70\n"
|
||||
"X-Generator: Poedit 3.2.2\n"
|
||||
|
||||
#: arrayfunc.c:66
|
||||
msgid "bad array subscript"
|
||||
@@ -3736,8 +3736,8 @@ msgstr ""
|
||||
" Varijable, za upotrebu u izrazima, ne moraju imati atribut cijelog broja.\n"
|
||||
"\n"
|
||||
" Operatori se vrednuju prema pravilima prednosti. Najprije se\n"
|
||||
" vrednuju pod-izrazi u zagradama i tako mogu prevagnuti nad gore\n"
|
||||
" opisanim pravilima prednosti.\n"
|
||||
" vrednuju pod-izrazi u zagradama i tako mogu redefinirati gore\n"
|
||||
" opisana pravilila prednosti.\n"
|
||||
"\n"
|
||||
" Ako je vrednovanje zadnjeg ARGUMENTA nula (0), „let“ završi s kȏdom 1;\n"
|
||||
" inače završi s uspjehom."
|
||||
|
||||
@@ -5639,6 +5639,7 @@ static struct name_and_function special_vars[] = {
|
||||
{ "FUNCNEST", sv_funcnest },
|
||||
|
||||
{ "GLOBIGNORE", sv_globignore },
|
||||
{ "GLOBSORT", sv_globsort },
|
||||
|
||||
#if defined (HISTORY)
|
||||
{ "HISTCONTROL", sv_history_control },
|
||||
@@ -5833,6 +5834,13 @@ sv_globignore (const char *name)
|
||||
setup_glob_ignore (name);
|
||||
}
|
||||
|
||||
/* What to do when GLOBSORT changes. */
|
||||
void
|
||||
sv_globsort (const char *name)
|
||||
{
|
||||
setup_globsort (name);
|
||||
}
|
||||
|
||||
#if defined (READLINE)
|
||||
void
|
||||
sv_comp_wordbreaks (const char *name)
|
||||
|
||||
@@ -431,6 +431,7 @@ extern void sv_opterr (const char *);
|
||||
extern void sv_locale (const char *);
|
||||
extern void sv_xtracefd (const char *);
|
||||
extern void sv_shcompat (const char *);
|
||||
extern void sv_globsort (const char *);
|
||||
|
||||
#if defined (READLINE)
|
||||
extern void sv_comp_wordbreaks (const char *);
|
||||
|
||||
Reference in New Issue
Block a user