commit bash-20080110 snapshot

This commit is contained in:
Chet Ramey
2011-12-07 09:17:25 -05:00
parent b246176e88
commit c2a47ea936
29 changed files with 9736 additions and 8615 deletions
+40
View File
@@ -15143,3 +15143,43 @@ lib/sh/getcwd.c
_path_checkino instead of directly comparing against d_fileno.
Fixes Interix problem reported by Michael Haubenwallner
<haubi@gentoo.org>
1/7/2008
--------
array.c
- fix array_subrange to separate elements in returned string with
first char of $IFS if QUOTED is non-zero, since this indicates
the caller used ${array[@]:foo}. Fixes bug reported by Lea
Wiemann <lewiemann@gmail.com>
1/8
---
subst.c
- new function returning a string containing the first character of
$IFS: char *ifs_firstchar(int *)
subst.h
- extern declaration for ifs_firstchar()
array.c
- call ifs_firstchar() to get first character of $IFS when needed
(array_subrange() and array_patsub())
1/11
----
lib/readline/display.c
- use sentinel variable set at end of init_line_structures to decide
whether to call it from rl_redisplay, since early SIGWINCH on
Mac OS X that hits during this function can cause _rl_wrapped_line
to be referenced before initialization. Fix for bug reported by
Len Lattanzi <llattanzi@apple.com>
subst.[ch]
- skip_to_delim is now compiled into the shell all the time, not just
when readline is linked in
subst.c
- use skip_to_delim to find the `/' denoting the end of a pattern
in pattern substitution, since it knows more shell syntax than
quoted_strchr and understands multibyte characters. Fixes bug
reported by Dmitry V Golovashkin <Dmitry.Golovashkin@sas.com>
+52
View File
@@ -15131,3 +15131,55 @@ execute_cmd.c
parse_and_execute_level to 0, since there's nothing left to
restore it if top_level_cleanup tests it. Fixes bug reported
by Len Lattanzi <llattanzi@apple.com>
12/31
-----
lib/sh/getcwd.c
- new function, _path_checkino, checks whether the inode corresponding
to the path constructed from the first two arguments is the same as
the inode number passed as the third argument
- if BROKEN_DIRENT_D_INO is defined, meaning the d_ino/d_fileno
member of struct dirent doesn't contain valid values, use
_path_checkino instead of directly comparing against d_fileno.
Fixes Interix problem reported by Michael Haubenwallner
<haubi@gentoo.org>
1/7/2008
--------
array.c
- fix array_subrange to separate elements in returned string with
first char of $IFS if QUOTED is non-zero, since this indicates
the caller used ${array[@]:foo}. Fixes bug reported by Lea
Wiemann <lewiemann@gmail.com>
1/8
---
subst.c
- new function returning a string containing the first character of
$IFS: char *ifs_firstchar(int *)
subst.h
- extern declaration for ifs_firstchar()
array.c
- call ifs_firstchar() to get first character of $IFS when needed
(array_subrange() and array_patsub())
1/11
----
lib/readline/display.c
- use sentinel variable set at end of init_line_structures to decide
whether to call it from rl_redisplay, since early SIGWINCH on
Mac OS X that hits during this function can cause _rl_wrapped_line
to be referenced before initialization. Fix for bug reported by
Len Lattanzi <llattanzi@apple.com>
subst.[ch]
- skip_to_delim is now compiled into the shell all the time, not just
when readline is linked in
subst.c
- use skip_to_delim to find the `/' denoting the end of a pattern
in pattern substitution, since it knows more shell syntax than
quoted_strchr. Fixes bug reported by Dmitry V Golovashkin
<Dmitry.Golovashkin@sas.com>
+21 -11
View File
@@ -329,7 +329,7 @@ int starsub, quoted;
ARRAY *a2;
ARRAY_ELEMENT *h, *p;
arrayind_t i;
char *ifs, sep[2], *t;
char *ifs, *sep, *t;
p = a ? array_head (a) : 0;
if (p == 0 || array_empty (a) || start > array_max_index(a))
@@ -360,14 +360,25 @@ int starsub, quoted;
array_quote_escapes(a2);
if (starsub && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) {
ifs = getifs();
sep[0] = ifs ? *ifs : '\0';
} else
/* ${array[*]} */
sep = ifs_firstchar ((int *)NULL);
} else if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) {
/* ${array[@]} */
sep = ifs_firstchar ((int *)NULL);
ifs = getifs ();
if (ifs == 0 || *ifs == 0) {
sep[0] = ' ';
sep[1] = '\0';
}
} else {
sep = xmalloc (2);
sep[0] = ' ';
sep[1] = '\0';
sep[1] = '\0';
}
t = array_to_string (a2, sep, 0);
array_dispose(a2);
free (sep);
return t;
}
@@ -380,7 +391,7 @@ int mflags;
{
ARRAY *a2;
ARRAY_ELEMENT *e;
char *t, *ifs, sifs[2];
char *t, *sifs;
if (a == 0 || array_head(a) == 0 || array_empty(a))
return ((char *)NULL);
@@ -397,10 +408,9 @@ int mflags;
else
array_quote_escapes(a2);
if (mflags & MATCH_STARSUB) {
ifs = getifs();
sifs[0] = ifs ? *ifs : '\0';
sifs[1] = '\0';
sifs = ifs_firstchar((int *)NULL);
t = array_to_string (a2, sifs, 0);
free(sifs);
} else
t = array_to_string (a2, " ", 0);
array_dispose (a2);
@@ -618,8 +628,8 @@ ARRAY *a;
}
/*
* Return a string that is the concatenation of all the elements in A,
* separated by SEP.
* Return a string that is the concatenation of the elements in A from START
* to END, separated by SEP.
*/
static char *
array_to_string_internal (start, end, sep, quoted)
+966
View File
@@ -0,0 +1,966 @@
/*
* array.c - functions to create, destroy, access, and manipulate arrays
* of strings.
*
* Arrays are sparse doubly-linked lists. An element's index is stored
* with it.
*
* Chet Ramey
* chet@ins.cwru.edu
*/
/* Copyright (C) 1997-2004 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 2, 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; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#include "config.h"
#if defined (ARRAY_VARS)
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include <sys/types.h>
# endif
# include <unistd.h>
#endif
#include <stdio.h>
#include "bashansi.h"
#include "shell.h"
#include "array.h"
#include "builtins/common.h"
#define ADD_BEFORE(ae, new) \
do { \
ae->prev->next = new; \
new->prev = ae->prev; \
ae->prev = new; \
new->next = ae; \
} while(0)
static char *array_to_string_internal __P((ARRAY_ELEMENT *, ARRAY_ELEMENT *, char *, int));
ARRAY *
array_create()
{
ARRAY *r;
ARRAY_ELEMENT *head;
r =(ARRAY *)xmalloc(sizeof(ARRAY));
r->type = array_indexed;
r->max_index = -1;
r->num_elements = 0;
head = array_create_element(-1, (char *)NULL); /* dummy head */
head->prev = head->next = head;
r->head = head;
return(r);
}
void
array_flush (a)
ARRAY *a;
{
register ARRAY_ELEMENT *r, *r1;
if (a == 0)
return;
for (r = element_forw(a->head); r != a->head; ) {
r1 = element_forw(r);
array_dispose_element(r);
r = r1;
}
a->head->next = a->head->prev = a->head;
a->max_index = -1;
a->num_elements = 0;
}
void
array_dispose(a)
ARRAY *a;
{
if (a == 0)
return;
array_flush (a);
array_dispose_element(a->head);
free(a);
}
ARRAY *
array_copy(a)
ARRAY *a;
{
ARRAY *a1;
ARRAY_ELEMENT *ae, *new;
if (a == 0)
return((ARRAY *) NULL);
a1 = array_create();
a1->type = a->type;
a1->max_index = a->max_index;
a1->num_elements = a->num_elements;
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) {
new = array_create_element(element_index(ae), element_value(ae));
ADD_BEFORE(a1->head, new);
}
return(a1);
}
/*
* Make and return a new array composed of the elements in array A from
* S to E, inclusive.
*/
ARRAY *
array_slice(array, s, e)
ARRAY *array;
ARRAY_ELEMENT *s, *e;
{
ARRAY *a;
ARRAY_ELEMENT *p, *n;
int i;
arrayind_t mi;
a = array_create ();
a->type = array->type;
for (p = s, i = 0; p != e; p = element_forw(p), i++) {
n = array_create_element (element_index(p), element_value(p));
ADD_BEFORE(a->head, n);
mi = element_index(n);
}
a->num_elements = i;
a->max_index = mi;
return a;
}
/*
* Walk the array, calling FUNC once for each element, with the array
* element as the argument.
*/
void
array_walk(a, func, udata)
ARRAY *a;
sh_ae_map_func_t *func;
void *udata;
{
register ARRAY_ELEMENT *ae;
if (a == 0 || array_empty(a))
return;
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae))
if ((*func)(ae, udata) < 0)
return;
}
/*
* Shift the array A N elements to the left. Delete the first N elements
* and subtract N from the indices of the remaining elements. If FLAGS
* does not include AS_DISPOSE, this returns a singly-linked null-terminated
* list of elements so the caller can dispose of the chain. If FLAGS
* includes AS_DISPOSE, this function disposes of the shifted-out elements
* and returns NULL.
*/
ARRAY_ELEMENT *
array_shift(a, n, flags)
ARRAY *a;
int n, flags;
{
register ARRAY_ELEMENT *ae, *ret;
register int i;
if (a == 0 || array_empty(a) || n <= 0)
return ((ARRAY_ELEMENT *)NULL);
for (i = 0, ret = ae = element_forw(a->head); ae != a->head && i < n; ae = element_forw(ae), i++)
;
if (ae == a->head) {
/* Easy case; shifting out all of the elements */
if (flags & AS_DISPOSE) {
array_flush (a);
return ((ARRAY_ELEMENT *)NULL);
}
for (ae = ret; element_forw(ae) != a->head; ae = element_forw(ae))
;
element_forw(ae) = (ARRAY_ELEMENT *)NULL;
a->head->next = a->head->prev = a->head;
a->max_index = -1;
a->num_elements = 0;
return ret;
}
/*
* ae now points to the list of elements we want to retain.
* ret points to the list we want to either destroy or return.
*/
ae->prev->next = (ARRAY_ELEMENT *)NULL; /* null-terminate RET */
a->head->next = ae; /* slice RET out of the array */
ae->prev = a->head;
for ( ; ae != a->head; ae = element_forw(ae))
element_index(ae) -= n; /* renumber retained indices */
a->num_elements -= n; /* modify bookkeeping information */
a->max_index -= n;
if (flags & AS_DISPOSE) {
for (ae = ret; ae; ) {
ret = element_forw(ae);
array_dispose_element(ae);
ae = ret;
}
return ((ARRAY_ELEMENT *)NULL);
}
return ret;
}
/*
* Shift array A right N indices. If S is non-null, it becomes the value of
* the new element 0. Returns the number of elements in the array after the
* shift.
*/
int
array_rshift (a, n, s)
ARRAY *a;
int n;
char *s;
{
register ARRAY_ELEMENT *ae, *new;
if (a == 0 || (array_empty(a) && s == 0))
return 0;
else if (n <= 0)
return (a->num_elements);
ae = element_forw(a->head);
if (s) {
new = array_create_element(0, s);
ADD_BEFORE(ae, new);
a->num_elements++;
if (array_num_elements(a) == 1) /* array was empty */
return 1;
}
/*
* Renumber all elements in the array except the one we just added.
*/
for ( ; ae != a->head; ae = element_forw(ae))
element_index(ae) += n;
a->max_index = element_index(a->head->prev);
return (a->num_elements);
}
ARRAY_ELEMENT *
array_unshift_element(a)
ARRAY *a;
{
return (array_shift (a, 1, 0));
}
int
array_shift_element(a, v)
ARRAY *a;
char *v;
{
return (array_rshift (a, 1, v));
}
ARRAY *
array_quote(array)
ARRAY *array;
{
ARRAY_ELEMENT *a;
char *t;
if (array == 0 || array_head(array) == 0 || array_empty(array))
return (ARRAY *)NULL;
for (a = element_forw(array->head); a != array->head; a = element_forw(a)) {
t = quote_string (a->value);
FREE(a->value);
a->value = t;
}
return array;
}
ARRAY *
array_quote_escapes(array)
ARRAY *array;
{
ARRAY_ELEMENT *a;
char *t;
if (array == 0 || array_head(array) == 0 || array_empty(array))
return (ARRAY *)NULL;
for (a = element_forw(array->head); a != array->head; a = element_forw(a)) {
t = quote_escapes (a->value);
FREE(a->value);
a->value = t;
}
return array;
}
/*
* Return a string whose elements are the members of array A beginning at
* index START and spanning NELEM members. Null elements are counted.
* Since arrays are sparse, unset array elements are not counted.
*/
char *
array_subrange (a, start, nelem, starsub, quoted)
ARRAY *a;
arrayind_t start, nelem;
int starsub, quoted;
{
ARRAY *a2;
ARRAY_ELEMENT *h, *p;
arrayind_t i;
char *ifs, sep[2], *t;
p = a ? array_head (a) : 0;
if (p == 0 || array_empty (a) || start > array_max_index(a))
return ((char *)NULL);
/*
* Find element with index START. If START corresponds to an unset
* element (arrays can be sparse), use the first element whose index
* is >= START. If START is < 0, we count START indices back from
* the end of A (not elements, even with sparse arrays -- START is an
* index).
*/
for (p = element_forw(p); p != array_head(a) && start > element_index(p); p = element_forw(p))
;
if (p == a->head)
return ((char *)NULL);
/* Starting at P, take NELEM elements, inclusive. */
for (i = 0, h = p; p != a->head && i < nelem; i++, p = element_forw(p))
;
a2 = array_slice(a, h, p);
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
array_quote(a2);
else
array_quote_escapes(a2);
if (starsub && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) {
/* ${array[*]} */
ifs = getifs();
sep[0] = ifs ? *ifs : '\0';
} else if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) {
/* ${array[@]}. Use ' ' to make sure the right splitting is
performed even when $IFS is "" */
ifs = getifs();
sep[0] = (ifs && *ifs) ? *ifs : ' ';
} else
sep[0] = ' ';
sep[1] = '\0';
t = array_to_string (a2, sep, 0);
array_dispose(a2);
return t;
}
char *
array_patsub (a, pat, rep, mflags)
ARRAY *a;
char *pat, *rep;
int mflags;
{
ARRAY *a2;
ARRAY_ELEMENT *e;
char *t, *ifs, sifs[2];
if (a == 0 || array_head(a) == 0 || array_empty(a))
return ((char *)NULL);
a2 = array_copy(a);
for (e = element_forw(a2->head); e != a2->head; e = element_forw(e)) {
t = pat_subst(element_value(e), pat, rep, mflags);
FREE(element_value(e));
e->value = t;
}
if (mflags & MATCH_QUOTED)
array_quote(a2);
else
array_quote_escapes(a2);
if (mflags & MATCH_STARSUB) {
ifs = getifs();
sifs[0] = ifs ? *ifs : '\0';
sifs[1] = '\0';
t = array_to_string (a2, sifs, 0);
} else
t = array_to_string (a2, " ", 0);
array_dispose (a2);
return t;
}
/*
* Allocate and return a new array element with index INDEX and value
* VALUE.
*/
ARRAY_ELEMENT *
array_create_element(indx, value)
arrayind_t indx;
char *value;
{
ARRAY_ELEMENT *r;
r = (ARRAY_ELEMENT *)xmalloc(sizeof(ARRAY_ELEMENT));
r->ind = indx;
r->value = value ? savestring(value) : (char *)NULL;
r->next = r->prev = (ARRAY_ELEMENT *) NULL;
return(r);
}
#ifdef INCLUDE_UNUSED
ARRAY_ELEMENT *
array_copy_element(ae)
ARRAY_ELEMENT *ae;
{
return(ae ? array_create_element(element_index(ae), element_value(ae))
: (ARRAY_ELEMENT *) NULL);
}
#endif
void
array_dispose_element(ae)
ARRAY_ELEMENT *ae;
{
if (ae) {
FREE(ae->value);
free(ae);
}
}
/*
* Add a new element with index I and value V to array A (a[i] = v).
*/
int
array_insert(a, i, v)
ARRAY *a;
arrayind_t i;
char *v;
{
register ARRAY_ELEMENT *new, *ae;
if (a == 0)
return(-1);
new = array_create_element(i, v);
if (i > array_max_index(a)) {
/*
* Hook onto the end. This also works for an empty array.
* Fast path for the common case of allocating arrays
* sequentially.
*/
ADD_BEFORE(a->head, new);
a->max_index = i;
a->num_elements++;
return(0);
}
/*
* Otherwise we search for the spot to insert it.
*/
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) {
if (element_index(ae) == i) {
/*
* Replacing an existing element.
*/
array_dispose_element(new);
free(element_value(ae));
ae->value = v ? savestring(v) : (char *)NULL;
return(0);
} else if (element_index(ae) > i) {
ADD_BEFORE(ae, new);
a->num_elements++;
return(0);
}
}
return (-1); /* problem */
}
/*
* Delete the element with index I from array A and return it so the
* caller can dispose of it.
*/
ARRAY_ELEMENT *
array_remove(a, i)
ARRAY *a;
arrayind_t i;
{
register ARRAY_ELEMENT *ae;
if (a == 0 || array_empty(a))
return((ARRAY_ELEMENT *) NULL);
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae))
if (element_index(ae) == i) {
ae->next->prev = ae->prev;
ae->prev->next = ae->next;
a->num_elements--;
if (i == array_max_index(a))
a->max_index = element_index(ae->prev);
return(ae);
}
return((ARRAY_ELEMENT *) NULL);
}
/*
* Return the value of a[i].
*/
char *
array_reference(a, i)
ARRAY *a;
arrayind_t i;
{
register ARRAY_ELEMENT *ae;
if (a == 0 || array_empty(a))
return((char *) NULL);
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae))
if (element_index(ae) == i)
return(element_value(ae));
return((char *) NULL);
}
/* Convenience routines for the shell to translate to and from the form used
by the rest of the code. */
WORD_LIST *
array_to_word_list(a)
ARRAY *a;
{
WORD_LIST *list;
ARRAY_ELEMENT *ae;
if (a == 0 || array_empty(a))
return((WORD_LIST *)NULL);
list = (WORD_LIST *)NULL;
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae))
list = make_word_list (make_bare_word(element_value(ae)), list);
return (REVERSE_LIST(list, WORD_LIST *));
}
ARRAY *
array_from_word_list (list)
WORD_LIST *list;
{
ARRAY *a;
if (list == 0)
return((ARRAY *)NULL);
a = array_create();
return (array_assign_list (a, list));
}
WORD_LIST *
array_keys_to_word_list(a)
ARRAY *a;
{
WORD_LIST *list;
ARRAY_ELEMENT *ae;
char *t;
if (a == 0 || array_empty(a))
return((WORD_LIST *)NULL);
list = (WORD_LIST *)NULL;
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) {
t = itos(element_index(ae));
list = make_word_list (make_bare_word(t), list);
free(t);
}
return (REVERSE_LIST(list, WORD_LIST *));
}
ARRAY *
array_assign_list (array, list)
ARRAY *array;
WORD_LIST *list;
{
register WORD_LIST *l;
register arrayind_t i;
for (l = list, i = 0; l; l = l->next, i++)
array_insert(array, i, l->word->word);
return array;
}
char **
array_to_argv (a)
ARRAY *a;
{
char **ret, *t;
int i;
ARRAY_ELEMENT *ae;
if (a == 0 || array_empty(a))
return ((char **)NULL);
ret = strvec_create (array_num_elements (a) + 1);
i = 0;
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) {
t = element_value (ae);
ret[i++] = t ? savestring (t) : (char *)NULL;
}
ret[i] = (char *)NULL;
return (ret);
}
/*
* Return a string that is the concatenation of the elements in A from START
* to END, separated by SEP.
*/
static char *
array_to_string_internal (start, end, sep, quoted)
ARRAY_ELEMENT *start, *end;
char *sep;
int quoted;
{
char *result, *t;
ARRAY_ELEMENT *ae;
int slen, rsize, rlen, reg;
if (start == end) /* XXX - should not happen */
return ((char *)NULL);
slen = strlen(sep);
result = NULL;
for (rsize = rlen = 0, ae = start; ae != end; ae = element_forw(ae)) {
if (rsize == 0)
result = (char *)xmalloc (rsize = 64);
if (element_value(ae)) {
t = quoted ? quote_string(element_value(ae)) : element_value(ae);
reg = strlen(t);
RESIZE_MALLOCED_BUFFER (result, rlen, (reg + slen + 2),
rsize, rsize);
strcpy(result + rlen, t);
rlen += reg;
if (quoted && t)
free(t);
/*
* Add a separator only after non-null elements.
*/
if (element_forw(ae) != end) {
strcpy(result + rlen, sep);
rlen += slen;
}
}
}
if (result)
result[rlen] = '\0'; /* XXX */
return(result);
}
char *
array_to_assign (a, quoted)
ARRAY *a;
int quoted;
{
char *result, *valstr, *is;
char indstr[INT_STRLEN_BOUND(intmax_t) + 1];
ARRAY_ELEMENT *ae;
int rsize, rlen, elen;
if (a == 0 || array_empty (a))
return((char *)NULL);
result = (char *)xmalloc (rsize = 128);
result[0] = '(';
rlen = 1;
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) {
is = inttostr (element_index(ae), indstr, sizeof(indstr));
valstr = element_value (ae) ? sh_double_quote (element_value(ae))
: (char *)NULL;
elen = STRLEN (indstr) + 8 + STRLEN (valstr);
RESIZE_MALLOCED_BUFFER (result, rlen, (elen + 1), rsize, rsize);
result[rlen++] = '[';
strcpy (result + rlen, is);
rlen += STRLEN (is);
result[rlen++] = ']';
result[rlen++] = '=';
if (valstr) {
strcpy (result + rlen, valstr);
rlen += STRLEN (valstr);
}
if (element_forw(ae) != a->head)
result[rlen++] = ' ';
FREE (valstr);
}
RESIZE_MALLOCED_BUFFER (result, rlen, 1, rsize, 8);
result[rlen++] = ')';
result[rlen] = '\0';
if (quoted) {
/* This is not as efficient as it could be... */
valstr = sh_single_quote (result);
free (result);
result = valstr;
}
return(result);
}
char *
array_to_string (a, sep, quoted)
ARRAY *a;
char *sep;
int quoted;
{
if (a == 0)
return((char *)NULL);
if (array_empty(a))
return(savestring(""));
return (array_to_string_internal (element_forw(a->head), a->head, sep, quoted));
}
#if defined (INCLUDE_UNUSED) || defined (TEST_ARRAY)
/*
* Return an array consisting of elements in S, separated by SEP
*/
ARRAY *
array_from_string(s, sep)
char *s, *sep;
{
ARRAY *a;
WORD_LIST *w;
if (s == 0)
return((ARRAY *)NULL);
w = list_string (s, sep, 0);
if (w == 0)
return((ARRAY *)NULL);
a = array_from_word_list (w);
return (a);
}
#endif
#if defined (TEST_ARRAY)
/*
* To make a running version, compile -DTEST_ARRAY and link with:
* xmalloc.o syntax.o lib/malloc/libmalloc.a lib/sh/libsh.a
*/
int interrupt_immediately = 0;
int
signal_is_trapped(s)
int s;
{
return 0;
}
void
fatal_error(const char *s, ...)
{
fprintf(stderr, "array_test: fatal memory error\n");
abort();
}
void
programming_error(const char *s, ...)
{
fprintf(stderr, "array_test: fatal programming error\n");
abort();
}
WORD_DESC *
make_bare_word (s)
const char *s;
{
WORD_DESC *w;
w = (WORD_DESC *)xmalloc(sizeof(WORD_DESC));
w->word = s ? savestring(s) : savestring ("");
w->flags = 0;
return w;
}
WORD_LIST *
make_word_list(x, l)
WORD_DESC *x;
WORD_LIST *l;
{
WORD_LIST *w;
w = (WORD_LIST *)xmalloc(sizeof(WORD_LIST));
w->word = x;
w->next = l;
return w;
}
WORD_LIST *
list_string(s, t, i)
char *s, *t;
int i;
{
char *r, *a;
WORD_LIST *wl;
if (s == 0)
return (WORD_LIST *)NULL;
r = savestring(s);
wl = (WORD_LIST *)NULL;
a = strtok(r, t);
while (a) {
wl = make_word_list (make_bare_word(a), wl);
a = strtok((char *)NULL, t);
}
return (REVERSE_LIST (wl, WORD_LIST *));
}
GENERIC_LIST *
list_reverse (list)
GENERIC_LIST *list;
{
register GENERIC_LIST *next, *prev;
for (prev = 0; list; ) {
next = list->next;
list->next = prev;
prev = list;
list = next;
}
return prev;
}
char *
pat_subst(s, t, u, i)
char *s, *t, *u;
int i;
{
return ((char *)NULL);
}
char *
quote_string(s)
char *s;
{
return savestring(s);
}
print_element(ae)
ARRAY_ELEMENT *ae;
{
char lbuf[INT_STRLEN_BOUND (intmax_t) + 1];
printf("array[%s] = %s\n",
inttostr (element_index(ae), lbuf, sizeof (lbuf)),
element_value(ae));
}
print_array(a)
ARRAY *a;
{
printf("\n");
array_walk(a, print_element, (void *)NULL);
}
main()
{
ARRAY *a, *new_a, *copy_of_a;
ARRAY_ELEMENT *ae, *aew;
char *s;
a = array_create();
array_insert(a, 1, "one");
array_insert(a, 7, "seven");
array_insert(a, 4, "four");
array_insert(a, 1029, "one thousand twenty-nine");
array_insert(a, 12, "twelve");
array_insert(a, 42, "forty-two");
print_array(a);
s = array_to_string (a, " ", 0);
printf("s = %s\n", s);
copy_of_a = array_from_string(s, " ");
printf("copy_of_a:");
print_array(copy_of_a);
array_dispose(copy_of_a);
printf("\n");
free(s);
ae = array_remove(a, 4);
array_dispose_element(ae);
ae = array_remove(a, 1029);
array_dispose_element(ae);
array_insert(a, 16, "sixteen");
print_array(a);
s = array_to_string (a, " ", 0);
printf("s = %s\n", s);
copy_of_a = array_from_string(s, " ");
printf("copy_of_a:");
print_array(copy_of_a);
array_dispose(copy_of_a);
printf("\n");
free(s);
array_insert(a, 2, "two");
array_insert(a, 1029, "new one thousand twenty-nine");
array_insert(a, 0, "zero");
array_insert(a, 134, "");
print_array(a);
s = array_to_string (a, ":", 0);
printf("s = %s\n", s);
copy_of_a = array_from_string(s, ":");
printf("copy_of_a:");
print_array(copy_of_a);
array_dispose(copy_of_a);
printf("\n");
free(s);
new_a = array_copy(a);
print_array(new_a);
s = array_to_string (new_a, ":", 0);
printf("s = %s\n", s);
copy_of_a = array_from_string(s, ":");
free(s);
printf("copy_of_a:");
print_array(copy_of_a);
array_shift(copy_of_a, 2, AS_DISPOSE);
printf("copy_of_a shifted by two:");
print_array(copy_of_a);
ae = array_shift(copy_of_a, 2, 0);
printf("copy_of_a shifted by two:");
print_array(copy_of_a);
for ( ; ae; ) {
aew = element_forw(ae);
array_dispose_element(ae);
ae = aew;
}
array_rshift(copy_of_a, 1, (char *)0);
printf("copy_of_a rshift by 1:");
print_array(copy_of_a);
array_rshift(copy_of_a, 2, "new element zero");
printf("copy_of_a rshift again by 2 with new element zero:");
print_array(copy_of_a);
s = array_to_assign(copy_of_a, 0);
printf("copy_of_a=%s\n", s);
free(s);
ae = array_shift(copy_of_a, array_num_elements(copy_of_a), 0);
for ( ; ae; ) {
aew = element_forw(ae);
array_dispose_element(ae);
ae = aew;
}
array_dispose(copy_of_a);
printf("\n");
array_dispose(a);
array_dispose(new_a);
}
#endif /* TEST_ARRAY */
#endif /* ARRAY_VARS */
+1829 -1825
View File
File diff suppressed because it is too large Load Diff
+12 -9
View File
@@ -3,7 +3,7 @@
</HEAD>
<BODY><TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2007 September 14<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2007 December 5<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<BR><A HREF="#index">Index</A>
@@ -532,12 +532,13 @@ No other startup files are read.
<B>Bash</B>
attempts to determine when it is being run by the remote shell
daemon, usually <I>rshd</I>.
attempts to determine when it is being run with its standard input
connected to a a network connection, as if by the remote shell
daemon, usually <I>rshd</I>, or the secure shell daemon <I>sshd</I>.
If
<B>bash</B>
determines it is being run by <I>rshd</I>, it reads and executes
determines it is being run in this fashion, it reads and executes
commands from <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>, if that file exists and is readable.
It will not do this if invoked as <B>sh</B>.
The
@@ -1684,7 +1685,9 @@ The command argument to the <B>-c</B> invocation option.
An array variable whose members are the line numbers in source files
corresponding to each member of <B>FUNCNAME</B>.
<B>${BASH_LINENO[</B><I>$i</I><B>]}</B> is the line number in the source
file where <B>${FUNCNAME[</B><I>$ifP</I><B>]}</B> was called.
file where <B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called
(or <B>${BASH_LINENO[</B><I>$i-1</I><B>]}</B> if referenced within another
shell function).
The corresponding source file name is <B>${BASH_SOURCE[</B><I>$i</I><B>]}.
Use LINENO</B> to obtain the current line number.
<DT><B>BASH_REMATCH</B>
@@ -9829,7 +9832,7 @@ keyword,
part of the test in an
<B>if</B>
statement, part of a
statement, part of a command executed in a
<B>&amp;&amp;</B>
or
@@ -10890,7 +10893,7 @@ keyword,
part of the test in an
<I>if</I>
statement, part of a
statement, part of a command executed in a
<B>&amp;&amp;</B>
or
@@ -11549,7 +11552,7 @@ Array variables may not (yet) be exported.
<HR>
<TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>GNU Bash-3.2<TH ALIGN=CENTER width=33%>2007 September 14<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>GNU Bash-3.2<TH ALIGN=CENTER width=33%>2007 December 5<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<HR>
@@ -11653,6 +11656,6 @@ Array variables may not (yet) be exported.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 10 October 2007 09:50:38 EDT
Time: 10 January 2008 17:41:32 EST
</BODY>
</HTML>
BIN
View File
Binary file not shown.
+4727 -4720
View File
File diff suppressed because it is too large Load Diff
+1 -4
View File
@@ -352,12 +352,9 @@
@xrdef{Major Differences From The Bourne Shell-title}{Major Differences From The Bourne Shell}
@xrdef{Major Differences From The Bourne Shell-pg}{133}
@xrdef{Major Differences From The Bourne Shell-snt}{Appendix@tie @char66{}}
@xrdef{Copying This Manual-title}{Copying This Manual}
@xrdef{Copying This Manual-pg}{139}
@xrdef{Copying This Manual-snt}{Appendix@tie @char67{}}
@xrdef{GNU Free Documentation License-title}{GNU Free Documentation License}
@xrdef{GNU Free Documentation License-pg}{139}
@xrdef{GNU Free Documentation License-snt}{Section@tie @char67.1}
@xrdef{GNU Free Documentation License-snt}{Appendix@tie @char67{}}
@xrdef{Indexes-title}{Indexes}
@xrdef{Indexes-pg}{147}
@xrdef{Indexes-snt}{Appendix@tie @char68{}}
-1
View File
@@ -115,4 +115,3 @@
\entry{configuration}{123}{configuration}
\entry{Bash installation}{123}{Bash installation}
\entry{Bash configuration}{123}{Bash configuration}
\entry{FDL, GNU Free Documentation License}{139}{FDL, GNU Free Documentation License}
-1
View File
@@ -50,7 +50,6 @@
\entry {expressions, arithmetic}{76}
\entry {expressions, conditional}{75}
\initial {F}
\entry {FDL, GNU Free Documentation License}{139}
\entry {field}{3}
\entry {filename}{3}
\entry {filename expansion}{23}
BIN
View File
Binary file not shown.
+216 -257
View File
File diff suppressed because it is too large Load Diff
+250 -261
View File
@@ -2,12 +2,12 @@ This is bashref.info, produced by makeinfo version 4.8 from
/Users/chet/src/bash/src/doc/bashref.texi.
This text is a brief description of the features that are present in
the Bash shell (version 3.2, 14 September 2007).
the Bash shell (version 3.2, 14 December 2007).
This is Edition 3.2, last updated 14 September 2007, of `The GNU
Bash Reference Manual', for `Bash', Version 3.2.
This is Edition 3.2, last updated 14 December 2007, of `The GNU Bash
Reference Manual', for `Bash', Version 3.2.
Copyright (C) 1988-2005 Free Software Foundation, Inc.
Copyright (C) 1988-2007 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@@ -17,13 +17,13 @@ preserved on all copies.
document under the terms of the GNU Free Documentation License,
Version 1.2 or any later version published by the Free Software
Foundation; with no Invariant Sections, with the Front-Cover texts
being "A GNU Manual," and with the Back-Cover Texts as in (a)
being "A GNU Manual", and with the Back-Cover Texts as in (a)
below. A copy of the license is included in the section entitled
"GNU Free Documentation License."
"GNU Free Documentation License".
(a) The FSF's Back-Cover Text is: "You have freedom to copy and
modify this GNU Manual, like GNU software. Copies published by
the Free Software Foundation raise funds for GNU development."
(a) The FSF's Back-Cover Text is: "You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom."
INFO-DIR-SECTION Basics
START-INFO-DIR-ENTRY
@@ -37,10 +37,10 @@ Bash Features
*************
This text is a brief description of the features that are present in
the Bash shell (version 3.2, 14 September 2007).
the Bash shell (version 3.2, 14 December 2007).
This is Edition 3.2, last updated 14 September 2007, of `The GNU
Bash Reference Manual', for `Bash', Version 3.2.
This is Edition 3.2, last updated 14 December 2007, of `The GNU Bash
Reference Manual', for `Bash', Version 3.2.
Bash contains features that appear in other popular shells, and some
features that only appear in Bash. Some of the shells that Bash has
@@ -64,15 +64,15 @@ on shell behavior.
* Bash Features:: Features found only in Bash.
* Job Control:: What job control is and how Bash allows you
to use it.
* Using History Interactively:: Command History Expansion
* Command Line Editing:: Chapter describing the command line
editing features.
* Using History Interactively:: Command History Expansion
* Installing Bash:: How to build and install Bash on your system.
* Reporting Bugs:: How to report bugs in Bash.
* Major Differences From The Bourne Shell:: A terse list of the differences
between Bash and historical
versions of /bin/sh.
* Copying This Manual:: Copying this manual.
* GNU Free Documentation License:: Copying and sharing this documentation.
* Indexes:: Various indexes for this manual.

@@ -2589,12 +2589,12 @@ standard.
subject to the following conditions. The `ERR' trap is not
executed if the failed command is part of the command list
immediately following an `until' or `while' keyword, part of the
test in an `if' statement, part of a `&&' or `||' list, or if the
command's return status is being inverted using `!'. These are
the same conditions obeyed by the `errexit' option. If a SIGSPEC
is `RETURN', the command ARG is executed each time a shell
function or a script executed with the `.' or `source' builtins
finishes executing.
test in an `if' statement, part of a command executed in a `&&' or
`||' list, or if the command's return status is being inverted
using `!'. These are the same conditions obeyed by the `errexit'
option. If a SIGSPEC is `RETURN', the command ARG is executed
each time a shell function or a script executed with the `.' or
`source' builtins finishes executing.
Signals ignored upon entry to the shell cannot be trapped or reset.
Trapped signals that are not being ignored are reset to their
@@ -3195,13 +3195,13 @@ parameters, or to display the names and values of shell variables.
Commands::) exits with a non-zero status, unless the command
that fails is part of the command list immediately following
a `while' or `until' keyword, part of the test in an `if'
statement, part of a `&&' or `||' list, any command in a
pipeline but the last, or if the command's return status is
being inverted using `!'. Failing simple commands that are
part of shell functions or command lists enclosed in braces
or parentheses satisfying the above conditions do not cause
the shell to exit. A trap on `ERR', if set, is executed
before the shell exits.
statement, part of a command executed in a `&&' or `||b' list,
any command in a pipeline but the last, or if the command's
return status is being inverted using `!'. Failing simple
commands that are part of shell functions or command lists
enclosed in braces or parentheses satisfying the above
conditions do not cause the shell to exit. A trap on `ERR',
if set, is executed before the shell exits.
`-f'
Disable file name generation (globbing).
@@ -3825,9 +3825,10 @@ Variables::).
An array variable whose members are the line numbers in source
files corresponding to each member of FUNCNAME.
`${BASH_LINENO[$i]}' is the line number in the source file where
`${FUNCNAME[$i]}' was called. The corresponding source file name
is `${BASH_SOURCE[$i]}'. Use `LINENO' to obtain the current line
number.
`${FUNCNAME[$i]}' was called (or `${BASH_LINENO[$i-1]}' if
referenced within another shell function). The corresponding
source file name is `${BASH_SOURCE[$i]}'. Use `LINENO' to obtain
the current line number.
`BASH_REMATCH'
An array variable whose members are assigned by the `=~' binary
@@ -4534,14 +4535,15 @@ startup files are read.
Invoked by remote shell daemon
..............................
Bash attempts to determine when it is being run by the remote shell
daemon, usually `rshd'. If Bash determines it is being run by rshd, it
reads and executes commands from `~/.bashrc', if that file exists and
is readable. It will not do this if invoked as `sh'. The `--norc'
option may be used to inhibit this behavior, and the `--rcfile' option
may be used to force another file to be read, but `rshd' does not
generally invoke the shell with those options or allow them to be
specified.
Bash attempts to determine when it is being run with its standard input
connected to a a network connection, as if by the remote shell daemon,
usually `rshd', or the secure shell daemon `sshd'. If Bash determines
it is being run in this fashion, it reads and executes commands from
`~/.bashrc', if that file exists and is readable. It will not do this
if invoked as `sh'. The `--norc' option may be used to inhibit this
behavior, and the `--rcfile' option may be used to force another file
to be read, but `rshd' does not generally invoke the shell with those
options or allow them to be specified.
Invoked with unequal effective and real UID/GIDs
................................................
@@ -5484,7 +5486,7 @@ specifying the `--enable-strict-posix-default' to `configure' when
building (*note Optional Features::).

File: bashref.info, Node: Job Control, Next: Using History Interactively, Prev: Bash Features, Up: Top
File: bashref.info, Node: Job Control, Next: Command Line Editing, Prev: Bash Features, Up: Top
7 Job Control
*************
@@ -5713,7 +5715,7 @@ File: bashref.info, Node: Job Control Variables, Prev: Job Control Builtins,

File: bashref.info, Node: Command Line Editing, Next: Installing Bash, Prev: Using History Interactively, Up: Top
File: bashref.info, Node: Command Line Editing, Next: Using History Interactively, Prev: Job Control, Up: Top
8 Command Line Editing
**********************
@@ -7376,7 +7378,7 @@ completion facilities.

File: bashref.info, Node: Using History Interactively, Next: Command Line Editing, Prev: Job Control, Up: Top
File: bashref.info, Node: Using History Interactively, Next: Installing Bash, Prev: Command Line Editing, Up: Top
9 Using History Interactively
*****************************
@@ -7749,7 +7751,7 @@ more of the following modifiers, each preceded by a `:'.

File: bashref.info, Node: Installing Bash, Next: Reporting Bugs, Prev: Command Line Editing, Up: Top
File: bashref.info, Node: Installing Bash, Next: Reporting Bugs, Prev: Using History Interactively, Up: Top
10 Installing Bash
******************
@@ -8232,7 +8234,7 @@ it provides for filing a bug report.
Please send all reports concerning this manual to <chet@po.CWRU.Edu>.

File: bashref.info, Node: Major Differences From The Bourne Shell, Next: Copying This Manual, Prev: Reporting Bugs, Up: Top
File: bashref.info, Node: Major Differences From The Bourne Shell, Next: GNU Free Documentation License, Prev: Reporting Bugs, Up: Top
Appendix B Major Differences From The Bourne Shell
**************************************************
@@ -8596,25 +8598,15 @@ many of the limitations of the SVR4.2 shell. For instance:
turns on job control).

File: bashref.info, Node: Copying This Manual, Next: Indexes, Prev: Major Differences From The Bourne Shell, Up: Top
File: bashref.info, Node: GNU Free Documentation License, Next: Indexes, Prev: Major Differences From The Bourne Shell, Up: Top
Appendix C Copying This Manual
******************************
* Menu:
* GNU Free Documentation License:: License for copying this manual.

File: bashref.info, Node: GNU Free Documentation License, Up: Copying This Manual
C.1 GNU Free Documentation License
==================================
Appendix C GNU Free Documentation License
*****************************************
Version 1.2, November 2002
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -8945,7 +8937,7 @@ C.1 GNU Free Documentation License
a storage or distribution medium, is called an "aggregate" if the
copyright resulting from the compilation is not used to limit the
legal rights of the compilation's users beyond what the individual
works permit. When the Document is included an aggregate, this
works permit. When the Document is included in an aggregate, this
License does not apply to the other works in the aggregate which
are not themselves derivative works of the Document.
@@ -9006,8 +8998,8 @@ C.1 GNU Free Documentation License
you may choose any version ever published (not as a draft) by the
Free Software Foundation.
C.1.1 ADDENDUM: How to use this License for your documents
----------------------------------------------------------
ADDENDUM: How to use this License for your documents
====================================================
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and license
@@ -9017,8 +9009,8 @@ notices just after the title page:
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled ``GNU
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
If you have Invariant Sections, Front-Cover Texts and Back-Cover
@@ -9038,7 +9030,7 @@ free software license, such as the GNU General Public License, to
permit their use in free software.

File: bashref.info, Node: Indexes, Prev: Copying This Manual, Up: Top
File: bashref.info, Node: Indexes, Prev: GNU Free Documentation License, Up: Top
Appendix D Indexes
******************
@@ -9223,11 +9215,11 @@ D.3 Parameter and Variable Index
* BASH_ENV: Bash Variables. (line 46)
* BASH_EXECUTION_STRING: Bash Variables. (line 52)
* BASH_LINENO: Bash Variables. (line 55)
* BASH_REMATCH: Bash Variables. (line 63)
* BASH_SOURCE: Bash Variables. (line 71)
* BASH_SUBSHELL: Bash Variables. (line 75)
* BASH_VERSINFO: Bash Variables. (line 79)
* BASH_VERSION: Bash Variables. (line 103)
* BASH_REMATCH: Bash Variables. (line 64)
* BASH_SOURCE: Bash Variables. (line 72)
* BASH_SUBSHELL: Bash Variables. (line 76)
* BASH_VERSINFO: Bash Variables. (line 80)
* BASH_VERSION: Bash Variables. (line 104)
* BASHPID: Bash Variables. (line 16)
* bell-style: Readline Init File Syntax.
(line 38)
@@ -9235,77 +9227,77 @@ D.3 Parameter and Variable Index
(line 45)
* CDPATH: Bourne Shell Variables.
(line 9)
* COLUMNS: Bash Variables. (line 106)
* COLUMNS: Bash Variables. (line 107)
* comment-begin: Readline Init File Syntax.
(line 50)
* COMP_CWORD: Bash Variables. (line 111)
* COMP_KEY: Bash Variables. (line 140)
* COMP_LINE: Bash Variables. (line 117)
* COMP_POINT: Bash Variables. (line 122)
* COMP_TYPE: Bash Variables. (line 130)
* COMP_WORDBREAKS: Bash Variables. (line 144)
* COMP_WORDS: Bash Variables. (line 150)
* COMP_CWORD: Bash Variables. (line 112)
* COMP_KEY: Bash Variables. (line 141)
* COMP_LINE: Bash Variables. (line 118)
* COMP_POINT: Bash Variables. (line 123)
* COMP_TYPE: Bash Variables. (line 131)
* COMP_WORDBREAKS: Bash Variables. (line 145)
* COMP_WORDS: Bash Variables. (line 151)
* completion-query-items: Readline Init File Syntax.
(line 60)
* COMPREPLY: Bash Variables. (line 157)
* COMPREPLY: Bash Variables. (line 158)
* convert-meta: Readline Init File Syntax.
(line 70)
* DIRSTACK: Bash Variables. (line 162)
* DIRSTACK: Bash Variables. (line 163)
* disable-completion: Readline Init File Syntax.
(line 76)
* editing-mode: Readline Init File Syntax.
(line 81)
* EMACS: Bash Variables. (line 172)
* EMACS: Bash Variables. (line 173)
* enable-keypad: Readline Init File Syntax.
(line 87)
* EUID: Bash Variables. (line 177)
* EUID: Bash Variables. (line 178)
* expand-tilde: Readline Init File Syntax.
(line 92)
* FCEDIT: Bash Variables. (line 181)
* FIGNORE: Bash Variables. (line 185)
* FUNCNAME: Bash Variables. (line 191)
* GLOBIGNORE: Bash Variables. (line 200)
* GROUPS: Bash Variables. (line 206)
* histchars: Bash Variables. (line 212)
* HISTCMD: Bash Variables. (line 227)
* HISTCONTROL: Bash Variables. (line 232)
* HISTFILE: Bash Variables. (line 248)
* HISTFILESIZE: Bash Variables. (line 252)
* HISTIGNORE: Bash Variables. (line 260)
* FCEDIT: Bash Variables. (line 182)
* FIGNORE: Bash Variables. (line 186)
* FUNCNAME: Bash Variables. (line 192)
* GLOBIGNORE: Bash Variables. (line 201)
* GROUPS: Bash Variables. (line 207)
* histchars: Bash Variables. (line 213)
* HISTCMD: Bash Variables. (line 228)
* HISTCONTROL: Bash Variables. (line 233)
* HISTFILE: Bash Variables. (line 249)
* HISTFILESIZE: Bash Variables. (line 253)
* HISTIGNORE: Bash Variables. (line 261)
* history-preserve-point: Readline Init File Syntax.
(line 96)
* HISTSIZE: Bash Variables. (line 279)
* HISTTIMEFORMAT: Bash Variables. (line 283)
* HISTSIZE: Bash Variables. (line 280)
* HISTTIMEFORMAT: Bash Variables. (line 284)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 102)
* HOSTFILE: Bash Variables. (line 292)
* HOSTNAME: Bash Variables. (line 303)
* HOSTTYPE: Bash Variables. (line 306)
* HOSTFILE: Bash Variables. (line 293)
* HOSTNAME: Bash Variables. (line 304)
* HOSTTYPE: Bash Variables. (line 307)
* IFS: Bourne Shell Variables.
(line 18)
* IGNOREEOF: Bash Variables. (line 309)
* IGNOREEOF: Bash Variables. (line 310)
* input-meta: Readline Init File Syntax.
(line 109)
* INPUTRC: Bash Variables. (line 319)
* INPUTRC: Bash Variables. (line 320)
* isearch-terminators: Readline Init File Syntax.
(line 116)
* keymap: Readline Init File Syntax.
(line 123)
* LANG: Bash Variables. (line 323)
* LC_ALL: Bash Variables. (line 327)
* LC_COLLATE: Bash Variables. (line 331)
* LC_CTYPE: Bash Variables. (line 338)
* LANG: Bash Variables. (line 324)
* LC_ALL: Bash Variables. (line 328)
* LC_COLLATE: Bash Variables. (line 332)
* LC_CTYPE: Bash Variables. (line 339)
* LC_MESSAGES <1>: Locale Translation. (line 11)
* LC_MESSAGES: Bash Variables. (line 343)
* LC_NUMERIC: Bash Variables. (line 347)
* LINENO: Bash Variables. (line 351)
* LINES: Bash Variables. (line 355)
* MACHTYPE: Bash Variables. (line 360)
* LC_MESSAGES: Bash Variables. (line 344)
* LC_NUMERIC: Bash Variables. (line 348)
* LINENO: Bash Variables. (line 352)
* LINES: Bash Variables. (line 356)
* MACHTYPE: Bash Variables. (line 361)
* MAIL: Bourne Shell Variables.
(line 22)
* MAILCHECK: Bash Variables. (line 364)
* MAILCHECK: Bash Variables. (line 365)
* MAILPATH: Bourne Shell Variables.
(line 27)
* mark-modified-lines: Readline Init File Syntax.
@@ -9316,46 +9308,46 @@ D.3 Parameter and Variable Index
(line 146)
* meta-flag: Readline Init File Syntax.
(line 109)
* OLDPWD: Bash Variables. (line 372)
* OLDPWD: Bash Variables. (line 373)
* OPTARG: Bourne Shell Variables.
(line 34)
* OPTERR: Bash Variables. (line 375)
* OPTERR: Bash Variables. (line 376)
* OPTIND: Bourne Shell Variables.
(line 38)
* OSTYPE: Bash Variables. (line 379)
* OSTYPE: Bash Variables. (line 380)
* output-meta: Readline Init File Syntax.
(line 153)
* page-completions: Readline Init File Syntax.
(line 158)
* PATH: Bourne Shell Variables.
(line 42)
* PIPESTATUS: Bash Variables. (line 382)
* POSIXLY_CORRECT: Bash Variables. (line 387)
* PPID: Bash Variables. (line 396)
* PROMPT_COMMAND: Bash Variables. (line 400)
* PIPESTATUS: Bash Variables. (line 383)
* POSIXLY_CORRECT: Bash Variables. (line 388)
* PPID: Bash Variables. (line 397)
* PROMPT_COMMAND: Bash Variables. (line 401)
* PS1: Bourne Shell Variables.
(line 48)
* PS2: Bourne Shell Variables.
(line 53)
* PS3: Bash Variables. (line 404)
* PS4: Bash Variables. (line 409)
* PWD: Bash Variables. (line 415)
* RANDOM: Bash Variables. (line 418)
* REPLY: Bash Variables. (line 423)
* SECONDS: Bash Variables. (line 426)
* SHELL: Bash Variables. (line 432)
* SHELLOPTS: Bash Variables. (line 437)
* SHLVL: Bash Variables. (line 446)
* PS3: Bash Variables. (line 405)
* PS4: Bash Variables. (line 410)
* PWD: Bash Variables. (line 416)
* RANDOM: Bash Variables. (line 419)
* REPLY: Bash Variables. (line 424)
* SECONDS: Bash Variables. (line 427)
* SHELL: Bash Variables. (line 433)
* SHELLOPTS: Bash Variables. (line 438)
* SHLVL: Bash Variables. (line 447)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 168)
* show-all-if-unmodified: Readline Init File Syntax.
(line 174)
* TEXTDOMAIN: Locale Translation. (line 11)
* TEXTDOMAINDIR: Locale Translation. (line 11)
* TIMEFORMAT: Bash Variables. (line 451)
* TMOUT: Bash Variables. (line 489)
* TMPDIR: Bash Variables. (line 501)
* UID: Bash Variables. (line 505)
* TIMEFORMAT: Bash Variables. (line 452)
* TMOUT: Bash Variables. (line 490)
* TMPDIR: Bash Variables. (line 502)
* UID: Bash Variables. (line 506)
* visible-stats: Readline Init File Syntax.
(line 183)
@@ -9532,8 +9524,6 @@ D.5 Concept Index
* expressions, arithmetic: Shell Arithmetic. (line 6)
* expressions, conditional: Bash Conditional Expressions.
(line 6)
* FDL, GNU Free Documentation License: GNU Free Documentation License.
(line 6)
* field: Definitions. (line 29)
* filename: Definitions. (line 34)
* filename expansion: Filename Expansion. (line 9)
@@ -9556,8 +9546,8 @@ D.5 Concept Index
* interactive shell: Invoking Bash. (line 127)
* internationalization: Locale Translation. (line 6)
* job: Definitions. (line 37)
* job control <1>: Definitions. (line 41)
* job control: Job Control Basics. (line 6)
* job control <1>: Job Control Basics. (line 6)
* job control: Definitions. (line 41)
* kill ring: Readline Killing Commands.
(line 19)
* killing text: Readline Killing Commands.
@@ -9605,8 +9595,8 @@ D.5 Concept Index
* shell, interactive: Interactive Shells. (line 6)
* signal: Definitions. (line 76)
* signal handling: Signals. (line 6)
* special builtin <1>: Definitions. (line 80)
* special builtin: Special Builtins. (line 6)
* special builtin <1>: Special Builtins. (line 6)
* special builtin: Definitions. (line 80)
* startup files: Bash Startup Files. (line 6)
* suspending jobs: Job Control Basics. (line 6)
* tilde expansion: Tilde Expansion. (line 6)
@@ -9623,132 +9613,131 @@ D.5 Concept Index

Tag Table:
Node: Top1359
Node: Introduction3171
Node: What is Bash?3399
Node: What is a shell?4512
Node: Definitions7052
Node: Basic Shell Features9821
Node: Shell Syntax11040
Node: Shell Operation12070
Node: Quoting13364
Node: Escape Character14667
Node: Single Quotes15152
Node: Double Quotes15500
Node: ANSI-C Quoting16625
Node: Locale Translation17581
Node: Comments18477
Node: Shell Commands19095
Node: Simple Commands19861
Node: Pipelines20492
Node: Lists22367
Node: Compound Commands23998
Node: Looping Constructs24782
Node: Conditional Constructs27229
Node: Command Grouping34789
Node: Shell Functions36268
Node: Shell Parameters40729
Node: Positional Parameters43059
Node: Special Parameters43959
Node: Shell Expansions46923
Node: Brace Expansion48848
Node: Tilde Expansion51174
Node: Shell Parameter Expansion53525
Node: Command Substitution61225
Node: Arithmetic Expansion62558
Node: Process Substitution63408
Node: Word Splitting64458
Node: Filename Expansion66081
Node: Pattern Matching68221
Node: Quote Removal71539
Node: Redirections71834
Node: Executing Commands79564
Node: Simple Command Expansion80234
Node: Command Search and Execution82164
Node: Command Execution Environment84170
Node: Environment86969
Node: Exit Status88629
Node: Signals89833
Node: Shell Scripts91801
Node: Shell Builtin Commands94319
Node: Bourne Shell Builtins95996
Node: Bash Builtins113204
Node: Modifying Shell Behavior133336
Node: The Set Builtin133681
Node: The Shopt Builtin142506
Node: Special Builtins152736
Node: Shell Variables153715
Node: Bourne Shell Variables154155
Node: Bash Variables156136
Node: Bash Features177431
Node: Invoking Bash178314
Node: Bash Startup Files184123
Node: Interactive Shells188982
Node: What is an Interactive Shell?189392
Node: Is this Shell Interactive?190041
Node: Interactive Shell Behavior190856
Node: Bash Conditional Expressions194136
Node: Shell Arithmetic197715
Node: Aliases200461
Node: Arrays203033
Node: The Directory Stack206382
Node: Directory Stack Builtins207096
Node: Printing a Prompt209988
Node: The Restricted Shell212702
Node: Bash POSIX Mode214534
Node: Job Control222293
Node: Job Control Basics222760
Node: Job Control Builtins227269
Node: Job Control Variables231596
Node: Command Line Editing232754
Node: Introduction and Notation233753
Node: Readline Interaction235375
Node: Readline Bare Essentials236566
Node: Readline Movement Commands238355
Node: Readline Killing Commands239320
Node: Readline Arguments241240
Node: Searching242284
Node: Readline Init File244470
Node: Readline Init File Syntax245617
Node: Conditional Init Constructs257992
Node: Sample Init File260525
Node: Bindable Readline Commands263642
Node: Commands For Moving264849
Node: Commands For History265710
Node: Commands For Text268865
Node: Commands For Killing271538
Node: Numeric Arguments273680
Node: Commands For Completion274819
Node: Keyboard Macros278412
Node: Miscellaneous Commands278983
Node: Readline vi Mode284294
Node: Programmable Completion285208
Node: Programmable Completion Builtins291026
Node: Using History Interactively298622
Node: Bash History Facilities299302
Node: Bash History Builtins302216
Node: History Interaction306073
Node: Event Designators308778
Node: Word Designators309793
Node: Modifiers311432
Node: Installing Bash312836
Node: Basic Installation313966
Node: Compilers and Options316658
Node: Compiling For Multiple Architectures317399
Node: Installation Names319063
Node: Specifying the System Type319881
Node: Sharing Defaults320597
Node: Operation Controls321270
Node: Optional Features322228
Node: Reporting Bugs331159
Node: Major Differences From The Bourne Shell332353
Node: Copying This Manual349022
Node: GNU Free Documentation License349292
Node: Indexes371698
Node: Builtin Index372141
Node: Reserved Word Index378674
Node: Variable Index381122
Node: Function Index392286
Node: Concept Index399018
Node: Top1348
Node: Introduction3187
Node: What is Bash?3415
Node: What is a shell?4528
Node: Definitions7068
Node: Basic Shell Features9837
Node: Shell Syntax11056
Node: Shell Operation12086
Node: Quoting13380
Node: Escape Character14683
Node: Single Quotes15168
Node: Double Quotes15516
Node: ANSI-C Quoting16641
Node: Locale Translation17597
Node: Comments18493
Node: Shell Commands19111
Node: Simple Commands19877
Node: Pipelines20508
Node: Lists22383
Node: Compound Commands24014
Node: Looping Constructs24798
Node: Conditional Constructs27245
Node: Command Grouping34805
Node: Shell Functions36284
Node: Shell Parameters40745
Node: Positional Parameters43075
Node: Special Parameters43975
Node: Shell Expansions46939
Node: Brace Expansion48864
Node: Tilde Expansion51190
Node: Shell Parameter Expansion53541
Node: Command Substitution61241
Node: Arithmetic Expansion62574
Node: Process Substitution63424
Node: Word Splitting64474
Node: Filename Expansion66097
Node: Pattern Matching68237
Node: Quote Removal71555
Node: Redirections71850
Node: Executing Commands79580
Node: Simple Command Expansion80250
Node: Command Search and Execution82180
Node: Command Execution Environment84186
Node: Environment86985
Node: Exit Status88645
Node: Signals89849
Node: Shell Scripts91817
Node: Shell Builtin Commands94335
Node: Bourne Shell Builtins96012
Node: Bash Builtins113242
Node: Modifying Shell Behavior133374
Node: The Set Builtin133719
Node: The Shopt Builtin142567
Node: Special Builtins152797
Node: Shell Variables153776
Node: Bourne Shell Variables154216
Node: Bash Variables156197
Node: Bash Features177569
Node: Invoking Bash178452
Node: Bash Startup Files184261
Node: Interactive Shells189230
Node: What is an Interactive Shell?189640
Node: Is this Shell Interactive?190289
Node: Interactive Shell Behavior191104
Node: Bash Conditional Expressions194384
Node: Shell Arithmetic197963
Node: Aliases200709
Node: Arrays203281
Node: The Directory Stack206630
Node: Directory Stack Builtins207344
Node: Printing a Prompt210236
Node: The Restricted Shell212950
Node: Bash POSIX Mode214782
Node: Job Control222541
Node: Job Control Basics223001
Node: Job Control Builtins227510
Node: Job Control Variables231837
Node: Command Line Editing232995
Node: Introduction and Notation233990
Node: Readline Interaction235612
Node: Readline Bare Essentials236803
Node: Readline Movement Commands238592
Node: Readline Killing Commands239557
Node: Readline Arguments241477
Node: Searching242521
Node: Readline Init File244707
Node: Readline Init File Syntax245854
Node: Conditional Init Constructs258229
Node: Sample Init File260762
Node: Bindable Readline Commands263879
Node: Commands For Moving265086
Node: Commands For History265947
Node: Commands For Text269102
Node: Commands For Killing271775
Node: Numeric Arguments273917
Node: Commands For Completion275056
Node: Keyboard Macros278649
Node: Miscellaneous Commands279220
Node: Readline vi Mode284531
Node: Programmable Completion285445
Node: Programmable Completion Builtins291263
Node: Using History Interactively298859
Node: Bash History Facilities299543
Node: Bash History Builtins302457
Node: History Interaction306314
Node: Event Designators309019
Node: Word Designators310034
Node: Modifiers311673
Node: Installing Bash313077
Node: Basic Installation314214
Node: Compilers and Options316906
Node: Compiling For Multiple Architectures317647
Node: Installation Names319311
Node: Specifying the System Type320129
Node: Sharing Defaults320845
Node: Operation Controls321518
Node: Optional Features322476
Node: Reporting Bugs331407
Node: Major Differences From The Bourne Shell332601
Node: GNU Free Documentation License349281
Node: Indexes371742
Node: Builtin Index372196
Node: Reserved Word Index378729
Node: Variable Index381177
Node: Function Index392341
Node: Concept Index399073

End Tag Table
+20 -20
View File
@@ -1,4 +1,4 @@
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2006.11.28) 10 OCT 2007 09:50
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2006.11.28) 10 JAN 2008 17:41
**/Users/chet/src/bash/src/doc/bashref.texi
(/Users/chet/src/bash/src/doc/bashref.texi (./texinfo.tex
Loading texinfo [version 2003-02-03.16]: Basics,
@@ -173,7 +173,7 @@ textttsl pat-tern@texttt ][]) @textttsl command-list @texttt ;;][] esac[][]
[11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25]
[26] [27] [28] [29] [30] [31] [32] Chapter 4 [33] [34] [35] [36] [37] [38]
[39] [40] [41]
Underfull \hbox (badness 5231) in paragraph at lines 3126--3139
Underfull \hbox (badness 5231) in paragraph at lines 3127--3140
@texttt emacs-meta[]@textrm , @texttt emacs-ctlx[]@textrm , @texttt vi[]@textr
m , @texttt vi-move[]@textrm , @texttt vi-command[]@textrm , and
@@ -186,7 +186,7 @@ m , @texttt vi-move[]@textrm , @texttt vi-command[]@textrm , and
.etc.
[42] [43] [44] [45]
Overfull \hbox (43.33536pt too wide) in paragraph at lines 3469--3469
Overfull \hbox (43.33536pt too wide) in paragraph at lines 3470--3470
[]@texttt read [-ers] [-a @textttsl aname@texttt ] [-d @textttsl de-lim@texttt
] [-n @textttsl nchars@texttt ] [-p @textttsl prompt@texttt ] [-t @textttsl ti
me-
@@ -200,7 +200,7 @@ me-
.etc.
[46] [47] [48] [49] [50] [51] [52] [53]
Underfull \hbox (badness 2573) in paragraph at lines 4096--4100
Underfull \hbox (badness 2573) in paragraph at lines 4097--4101
[] []@textrm Error trac-ing is en-abled: com-mand sub-sti-tu-tion, shell
@hbox(7.60416+2.12917)x433.62, glue set 2.95305
@@ -217,7 +217,7 @@ Underfull \hbox (badness 2573) in paragraph at lines 4096--4100
[54] [55] [56] Chapter 5 [57] [58] [59] [60] [61] [62] [63] [64] [65] [66]
Chapter 6 [67] [68]
Overfull \hbox (51.96864pt too wide) in paragraph at lines 4912--4912
Overfull \hbox (51.96864pt too wide) in paragraph at lines 4914--4914
[]@texttt bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@t
exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
@@ -230,7 +230,7 @@ exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
.etc.
Overfull \hbox (76.23077pt too wide) in paragraph at lines 4913--4913
Overfull \hbox (76.23077pt too wide) in paragraph at lines 4915--4915
[]@texttt bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@texttt
] [-O @textttsl shopt_option@texttt ] -c @textttsl string @texttt [@textttsl ar
-
@@ -244,7 +244,7 @@ Overfull \hbox (76.23077pt too wide) in paragraph at lines 4913--4913
.etc.
Overfull \hbox (34.72258pt too wide) in paragraph at lines 4914--4914
Overfull \hbox (34.72258pt too wide) in paragraph at lines 4916--4916
[]@texttt bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@text
tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
@@ -257,7 +257,7 @@ tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
.etc.
[69] [70]
Underfull \hbox (badness 2245) in paragraph at lines 5088--5090
Underfull \hbox (badness 2245) in paragraph at lines 5090--5092
[]@textrm When a lo-gin shell ex-its, Bash reads and ex-e-cutes com-mands from
the file
@@ -270,7 +270,7 @@ the file
.etc.
[71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82] [83] [84]
Underfull \hbox (badness 2521) in paragraph at lines 6202--6205
Underfull \hbox (badness 2521) in paragraph at lines 6206--6209
@textrm `@texttt --enable-strict-posix-default[]@textrm '[] to @texttt configur
e[] @textrm when build-ing (see Sec-tion 10.8
@@ -285,7 +285,7 @@ e[] @textrm when build-ing (see Sec-tion 10.8
Chapter 7 [85] [86] [87] [88] [89]
(/Users/chet/src/bash/src/lib/readline/doc/rluser.texi Chapter 8 [90] [91]
[92] [93] [94] [95]
Underfull \hbox (badness 5231) in paragraph at lines 503--519
Underfull \hbox (badness 5231) in paragraph at lines 502--518
@texttt emacs-meta[]@textrm , @texttt emacs-ctlx[]@textrm , @texttt vi[]@textr
m , @texttt vi-move[]@textrm , @texttt vi-command[]@textrm , and
@@ -298,7 +298,7 @@ m , @texttt vi-move[]@textrm , @texttt vi-command[]@textrm , and
.etc.
[96] [97] [98] [99] [100]
Overfull \hbox (26.43913pt too wide) in paragraph at lines 818--818
Overfull \hbox (26.43913pt too wide) in paragraph at lines 817--817
[]@texttt Meta-Control-h: backward-kill-word Text after the function name is i
gnored[]
@@ -311,7 +311,7 @@ gnored[]
.etc.
[101] [102] [103] [104] [105] [106] [107] [108] [109] [110] [111] [112]
Overfull \hbox (17.80585pt too wide) in paragraph at lines 1667--1667
Overfull \hbox (17.80585pt too wide) in paragraph at lines 1666--1666
[]@texttt complete [-abcdefgjksuv] [-o @textttsl comp-option@texttt ] [-A @tex
tttsl ac-tion@texttt ] [-G @textttsl glob-
@@ -324,7 +324,7 @@ tttsl ac-tion@texttt ] [-G @textttsl glob-
.etc.
[113] [114]
Underfull \hbox (badness 2753) in paragraph at lines 1769--1772
Underfull \hbox (badness 2753) in paragraph at lines 1768--1771
@texttt hostname[]@textrm Hostnames, as taken from the file spec-i-fied by
@hbox(7.60416+2.12917)x433.62, glue set 3.02202
@@ -337,7 +337,7 @@ Underfull \hbox (badness 2753) in paragraph at lines 1769--1772
[115]) (/Users/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9
[116] [117] [118] [119] [120]) Chapter 10 [121] [122] [123] [124] [125]
Underfull \hbox (badness 2772) in paragraph at lines 6798--6802
Underfull \hbox (badness 2772) in paragraph at lines 6802--6806
[]@textrm Enable sup-port for large files (@texttt http://www.sas.com/standard
s/large_
@@ -372,12 +372,12 @@ Overfull \vbox (45.46959pt too high) has occurred while \output is active
[148] (./bashref.rws) (./bashref.vrs [149] [150]) (./bashref.fns [151])
[152] (./bashref.cps [153]) [154] )
Here is how much of TeX's memory you used:
1735 strings out of 97980
23708 string characters out of 1221004
55369 words of memory out of 1000000
2586 multiletter control sequences out of 10000+50000
1732 strings out of 97980
23635 string characters out of 1221004
55301 words of memory out of 1000000
2583 multiletter control sequences out of 10000+50000
31953 words of font info for 111 fonts, out of 500000 for 2000
19 hyphenation exceptions out of 1000
15i,8n,11p,269b,474s stack positions out of 1500i,500n,5000p,200000b,5000s
15i,8n,11p,269b,471s stack positions out of 1500i,500n,5000p,200000b,5000s
Output written on bashref.dvi (160 pages, 612624 bytes).
Output written on bashref.dvi (160 pages, 612328 bytes).
+971 -993
View File
File diff suppressed because it is too large Load Diff
+1 -3
View File
@@ -126,9 +126,7 @@
\appendixentry{Reporting Bugs}{A}{131}
\appendixentry{Major Differences From The Bourne Shell}{B}{133}
\secentry{Implementation Differences From The SVR4.2 Shell}{B}{1}{137}
\appendixentry{Copying This Manual}{C}{139}
\secentry{GNU Free Documentation License}{C}{1}{139}
\subsecentry{ADDENDUM: How to use this License for your documents}{C}{1}{1}{145}
\appendixentry{GNU Free Documentation License}{C}{139}
\appendixentry{Indexes}{D}{147}
\secentry{Index of Shell Builtin Commands}{D}{1}{147}
\secentry{Index of Shell Reserved Words}{D}{2}{149}
+18 -17
View File
@@ -871,13 +871,14 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
above) exits with a non-zero status. The shell does not
exit if the command that fails is part of the command
list immediately following a wwhhiillee or uunnttiill keyword,
part of the test in an iiff statement, part of a &&&& or ||||
list, any command in a pipeline but the last, or if the
command's return value is being inverted via !!. Failing
simple commands that are part of shell functions or com-
mand lists enclosed in braces or parentheses satisfying
the above conditions do not cause the shell to exit. A
trap on EERRRR, if set, is executed before the shell exits.
part of the test in an iiff statement, part of a command
executed in a &&&& or |||| list, any command in a pipeline
but the last, or if the command's return value is being
inverted via !!. Failing simple commands that are part
of shell functions or command lists enclosed in braces
or parentheses satisfying the above conditions do not
cause the shell to exit. A trap on EERRRR, if set, is exe-
cuted before the shell exits.
--ff Disable pathname expansion.
--hh Remember the location of commands as they are looked up
for execution. This is enabled by default.
@@ -1305,16 +1306,16 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
non-zero exit status, subject to the following conditions. The
EERRRR trap is not executed if the failed command is part of the
command list immediately following a wwhhiillee or uunnttiill keyword,
part of the test in an _i_f statement, part of a &&&& or |||| list, or
if the command's return value is being inverted via !!. These
are the same conditions obeyed by the eerrrreexxiitt option. If a
_s_i_g_s_p_e_c is RREETTUURRNN, the command _a_r_g is executed each time a shell
function or a script executed with the .. or ssoouurrccee builtins fin-
ishes executing. Signals ignored upon entry to the shell cannot
be trapped or reset. Trapped signals that are not being ignored
are reset to their original values in a child process when it is
created. The return status is false if any _s_i_g_s_p_e_c is invalid;
otherwise ttrraapp returns true.
part of the test in an _i_f statement, part of a command executed
in a &&&& or |||| list, or if the command's return value is being
inverted via !!. These are the same conditions obeyed by the
eerrrreexxiitt option. If a _s_i_g_s_p_e_c is RREETTUURRNN, the command _a_r_g is exe-
cuted each time a shell function or a script executed with the ..
or ssoouurrccee builtins finishes executing. Signals ignored upon
entry to the shell cannot be trapped or reset. Trapped signals
that are not being ignored are reset to their original values in
a child process when it is created. The return status is false
if any _s_i_g_s_p_e_c is invalid; otherwise ttrraapp returns true.
ttyyppee [--aaffttppPP] _n_a_m_e [_n_a_m_e ...]
With no options, indicate how each _n_a_m_e would be interpreted if
+396 -395
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.19.1
%%CreationDate: Wed Oct 10 09:50:26 2007
%%CreationDate: Thu Jan 10 17:41:20 2008
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.19 1
+8 -3
View File
@@ -82,6 +82,7 @@ struct line_state
static struct line_state line_state_array[2];
static struct line_state *line_state_visible = &line_state_array[0];
static struct line_state *line_state_invisible = &line_state_array[1];
static int line_structures_initialized = 0;
/* Backwards-compatible names. */
#define inv_lbreaks (line_state_invisible->lbreaks)
@@ -471,8 +472,7 @@ init_line_structures (minsize)
{
/* should be enough. */
inv_lbsize = vis_lbsize = 256;
inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
#if defined (HANDLE_MULTIBYTE)
line_state_visible->wbsize = vis_lbsize;
line_state_visible->wrapped_line = (int *)xmalloc (line_state_visible->wbsize * sizeof (int));
@@ -480,8 +480,13 @@ init_line_structures (minsize)
line_state_invisible->wbsize = inv_lbsize;
line_state_invisible->wrapped_line = (int *)xmalloc (line_state_invisible->wbsize * sizeof (int));
#endif
inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
inv_lbreaks[0] = vis_lbreaks[0] = 0;
}
line_structures_initialized = 1;
}
/* Basic redisplay algorithm. */
@@ -507,7 +512,7 @@ rl_redisplay ()
if (!rl_display_prompt)
rl_display_prompt = "";
if (invisible_line == 0 || vis_lbreaks == 0)
if (line_structures_initialized == 0)
{
init_line_structures (0);
rl_on_new_line ();
+11 -7
View File
@@ -82,6 +82,7 @@ struct line_state
static struct line_state line_state_array[2];
static struct line_state *line_state_visible = &line_state_array[0];
static struct line_state *line_state_invisible = &line_state_array[1];
static int line_structures_initialized = 0;
/* Backwards-compatible names. */
#define inv_lbreaks (line_state_invisible->lbreaks)
@@ -471,8 +472,7 @@ init_line_structures (minsize)
{
/* should be enough. */
inv_lbsize = vis_lbsize = 256;
inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
#if defined (HANDLE_MULTIBYTE)
line_state_visible->wbsize = vis_lbsize;
line_state_visible->wrapped_line = (int *)xmalloc (line_state_visible->wbsize * sizeof (int));
@@ -480,8 +480,13 @@ init_line_structures (minsize)
line_state_invisible->wbsize = inv_lbsize;
line_state_invisible->wrapped_line = (int *)xmalloc (line_state_invisible->wbsize * sizeof (int));
#endif
inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
inv_lbreaks[0] = vis_lbreaks[0] = 0;
}
line_structures_initialized = 1;
}
/* Basic redisplay algorithm. */
@@ -507,7 +512,7 @@ rl_redisplay ()
if (!rl_display_prompt)
rl_display_prompt = "";
if (invisible_line == 0 || vis_lbreaks == 0)
if (line_structures_initialized == 0)
{
init_line_structures (0);
rl_on_new_line ();
@@ -651,6 +656,7 @@ rl_redisplay ()
#endif
#if defined (HANDLE_MULTIBYTE)
if (line_state_invisible
memset (line_state_invisible->wrapped_line, 0, line_state_invisible->wbsize * sizeof (int));
num = 0;
#endif
@@ -938,8 +944,9 @@ rl_redisplay ()
second and subsequent lines start at inv_lbreaks[N], offset by
OFFSET (which has already been calculated above). */
#define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset)
#define WRAP_OFFSET(line, offset) ((line == 0) \
? (offset ? prompt_invis_chars_first_line : 0) \
? (offset ? INVIS_FIRST() : 0) \
: ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0))
#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
@@ -1618,9 +1625,6 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
}
else
{
/* We have horizontal scrolling and we are not inserting at
the end. We have invisible characters in this line. This
is a dumb update. */
_rl_output_some_chars (nfd, temp);
_rl_last_c_pos += col_temp;
/* If nfd begins before any invisible characters in the prompt,
+129 -82
View File
@@ -1362,6 +1362,87 @@ unquote_bang (string)
}
#endif
/* Skip characters in STRING until we find a character in DELIMS, and return
the index of that character. START is the index into string at which we
begin. This is similar in spirit to strpbrk, but it returns an index into
STRING and takes a starting index. This little piece of code knows quite
a lot of shell syntax. It's very similar to skip_double_quoted and other
functions of that ilk. */
int
skip_to_delim (string, start, delims)
char *string;
int start;
char *delims;
{
int i, pass_next, backq, si, c;
size_t slen;
char *temp;
DECLARE_MBSTATE;
slen = strlen (string + start) + start;
no_longjmp_on_fatal_error = 1;
i = start;
pass_next = backq = 0;
while (c = string[i])
{
if (pass_next)
{
pass_next = 0;
if (c == 0)
CQ_RETURN(i);
ADVANCE_CHAR (string, slen, i);
continue;
}
else if (c == '\\')
{
pass_next = 1;
i++;
continue;
}
else if (backq)
{
if (c == '`')
backq = 0;
ADVANCE_CHAR (string, slen, i);
continue;
}
else if (c == '`')
{
backq = 1;
i++;
continue;
}
else if (c == '\'' || c == '"')
{
i = (c == '\'') ? skip_single_quoted (string, slen, ++i)
: skip_double_quoted (string, slen, ++i);
/* no increment, the skip functions increment past the closing quote. */
}
else if (c == '$' && (string[i+1] == LPAREN || string[i+1] == LBRACE))
{
si = i + 2;
if (string[si] == '\0')
CQ_RETURN(si);
if (string[i+1] == LPAREN)
temp = extract_delimited_string (string, &si, "$(", "(", ")", SX_NOALLOC|SX_COMMAND); /* ) */
else
temp = extract_dollar_brace_string (string, &si, 0, SX_NOALLOC);
i = si;
if (string[i] == '\0') /* don't increment i past EOS in loop */
break;
i++;
continue;
}
else if (member (c, delims))
break;
else
ADVANCE_CHAR (string, slen, i);
}
CQ_RETURN(i);
}
#if defined (READLINE)
/* Return 1 if the portion of STRING ending at EINDEX is quoted (there is
an unclosed quoted string), or if the character at EINDEX is quoted
@@ -1465,87 +1546,6 @@ unclosed_pair (string, eindex, openstr)
return (openc);
}
/* Skip characters in STRING until we find a character in DELIMS, and return
the index of that character. START is the index into string at which we
begin. This is similar in spirit to strpbrk, but it returns an index into
STRING and takes a starting index. This little piece of code knows quite
a lot of shell syntax. It's very similar to skip_double_quoted and other
functions of that ilk. */
int
skip_to_delim (string, start, delims)
char *string;
int start;
char *delims;
{
int i, pass_next, backq, si, c;
size_t slen;
char *temp;
DECLARE_MBSTATE;
slen = strlen (string + start) + start;
no_longjmp_on_fatal_error = 1;
i = start;
pass_next = backq = 0;
while (c = string[i])
{
if (pass_next)
{
pass_next = 0;
if (c == 0)
CQ_RETURN(i);
ADVANCE_CHAR (string, slen, i);
continue;
}
else if (c == '\\')
{
pass_next = 1;
i++;
continue;
}
else if (backq)
{
if (c == '`')
backq = 0;
ADVANCE_CHAR (string, slen, i);
continue;
}
else if (c == '`')
{
backq = 1;
i++;
continue;
}
else if (c == '\'' || c == '"')
{
i = (c == '\'') ? skip_single_quoted (string, slen, ++i)
: skip_double_quoted (string, slen, ++i);
/* no increment, the skip functions increment past the closing quote. */
}
else if (c == '$' && (string[i+1] == LPAREN || string[i+1] == LBRACE))
{
si = i + 2;
if (string[si] == '\0')
CQ_RETURN(si);
if (string[i+1] == LPAREN)
temp = extract_delimited_string (string, &si, "$(", "(", ")", SX_NOALLOC|SX_COMMAND); /* ) */
else
temp = extract_dollar_brace_string (string, &si, 0, SX_NOALLOC);
i = si;
if (string[i] == '\0') /* don't increment i past EOS in loop */
break;
i++;
continue;
}
else if (member (c, delims))
break;
else
ADVANCE_CHAR (string, slen, i);
}
CQ_RETURN(i);
}
/* Split STRING (length SLEN) at DELIMS, and return a WORD_LIST with the
individual words. If DELIMS is NULL, the current value of $IFS is used
to split the string, and the function follows the shell field splitting
@@ -1796,6 +1796,42 @@ string_list (list)
return (string_list_internal (list, " "));
}
/* An external interface that can be used by the rest of the shell to
obtain a string containing the first character in $IFS. Handles all
the multibyte complications. If LENP is non-null, it is set to the
length of the returned string. */
char *
ifs_firstchar (lenp)
int *lenp;
{
char *ret;
int len;
ret = xmalloc (MB_LEN_MAX + 1);
#if defined (HANDLE_MULTIBYTE)
if (ifs_firstc_len == 1)
{
ret[0] = ifs_firstc[0];
ret[1] = '\0';
len = ret[0] ? 1 : 0;
}
else
{
memcpy (ret, ifs_firstc, ifs_firstc_len);
ret[len = ifs_firstc_len] = '\0';
}
#else
ret[0] = ifs_firstc;
ret[1] = '\0';
len = ret[0] ? 0 : 1;
#endif
if (lenp)
*lenp = len;
return ret;
}
/* Return a single string of all the words present in LIST, obeying the
quoting rules for "$*", to wit: (P1003.2, draft 11, 3.5.2) "If the
expansion [of $*] appears within a double quoted string, it expands
@@ -5806,7 +5842,7 @@ parameter_brace_patsub (varname, value, patsub, quoted)
char *varname, *value, *patsub;
int quoted;
{
int vtype, mflags, starsub;
int vtype, mflags, starsub, delim;
char *val, *temp, *pat, *rep, *p, *lpatsub, *tt;
SHELL_VAR *v;
@@ -5841,10 +5877,21 @@ parameter_brace_patsub (varname, value, patsub, quoted)
/* If the pattern starts with a `/', make sure we skip over it when looking
for the replacement delimiter. */
#if 0
if (rep = quoted_strchr ((*patsub == '/') ? lpatsub+1 : lpatsub, '/', ST_BACKSL))
*rep++ = '\0';
else
rep = (char *)NULL;
#else
delim = skip_to_delim (lpatsub, ((*patsub == '/') ? 1 : 0), "/");
if (lpatsub[delim] == '/')
{
lpatsub[delim] = 0;
rep = lpatsub + delim + 1;
}
else
rep = (char *)NULL;
#endif
if (rep && *rep == '\0')
rep = (char *)NULL;
+49 -2
View File
@@ -1796,6 +1796,42 @@ string_list (list)
return (string_list_internal (list, " "));
}
/* An external interface that can be used by the rest of the shell to
obtain a string containing the first character in $IFS. Handles all
the multibyte complications. If LENP is non-null, it is set to the
length of the returned string. */
char *
ifs_firstchar (lenp)
int *lenp;
{
char *ret;
int len;
ret = xmalloc (MB_LEN_MAX + 1);
#if defined (HANDLE_MULTIBYTE)
if (ifs_firstc_len == 1)
{
ret[0] = ifs_firstc[0];
ret[1] = '\0';
len = ret[0] ? 1 : 0;
}
else
{
memcpy (ret, ifs_firstc, ifs_firstc_len);
ret[len = ifs_firstc_len] = '\0';
}
#else
ret[0] = ifs_firstc;
ret[1] = '\0';
len = ret[0] ? 0 : 1;
#endif
if (lenp)
*lenp = len;
return ret;
}
/* Return a single string of all the words present in LIST, obeying the
quoting rules for "$*", to wit: (P1003.2, draft 11, 3.5.2) "If the
expansion [of $*] appears within a double quoted string, it expands
@@ -5806,7 +5842,7 @@ parameter_brace_patsub (varname, value, patsub, quoted)
char *varname, *value, *patsub;
int quoted;
{
int vtype, mflags, starsub;
int vtype, mflags, starsub, delim;
char *val, *temp, *pat, *rep, *p, *lpatsub, *tt;
SHELL_VAR *v;
@@ -5841,10 +5877,21 @@ parameter_brace_patsub (varname, value, patsub, quoted)
/* If the pattern starts with a `/', make sure we skip over it when looking
for the replacement delimiter. */
#if 0
if (rep = quoted_strchr ((*patsub == '/') ? lpatsub+1 : lpatsub, '/', ST_BACKSL))
*rep++ = '\0';
else
rep = (char *)NULL;
#else
delim = skip_to_delim (lpatsub, ((*patsub == '/') ? 1 : 0), "/");
if (lpatsub[delim] == '/')
{
lpatsub[delim] = 0;
rep = lpatsub + delim + 1;
}
else
rep = (char *)NULL;
#endif
if (rep && *rep == '\0')
rep = (char *)NULL;
@@ -7034,7 +7081,7 @@ add_string:
free (temp);
temp = temp1;
sindex += t_index;
goto add_string;
goto add_quoted_string; /* XXX was add_string */
}
else
{
+3 -1
View File
@@ -92,6 +92,7 @@ extern void word_list_remove_quoted_nulls __P((WORD_LIST *));
STRING. */
extern WORD_LIST *list_string __P((char *, char *, int));
extern char *ifs_firstchar __P((int *));
extern char *get_word_from_string __P((char **, char *, char **));
extern char *strip_trailing_ifs_whitespace __P((char *, char *, int));
@@ -239,10 +240,11 @@ extern char *remove_backslashes __P((char *));
extern char *cond_expand_word __P((WORD_DESC *, int));
#endif
extern int skip_to_delim __P((char *, int, char *));
#if defined (READLINE)
extern int char_is_quoted __P((char *, int));
extern int unclosed_pair __P((char *, int, char *));
extern int skip_to_delim __P((char *, int, char *));
extern WORD_LIST *split_at_delims __P((char *, int, char *, int, int *, int *));
#endif
+2 -1
View File
@@ -1,6 +1,6 @@
/* subst.h -- Names of externally visible functions in subst.c. */
/* Copyright (C) 1993-2004 Free Software Foundation, Inc.
/* Copyright (C) 1993-2007 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -92,6 +92,7 @@ extern void word_list_remove_quoted_nulls __P((WORD_LIST *));
STRING. */
extern WORD_LIST *list_string __P((char *, char *, int));
extern char *ifs_firstchar __P((int *));
extern char *get_word_from_string __P((char **, char *, char **));
extern char *strip_trailing_ifs_whitespace __P((char *, char *, int));
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/chet/bash/bash-current
BUILD_DIR=/usr/local/build/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
+2
View File
@@ -496,6 +496,8 @@ one
123456789
9
9
4, A B C D
2, C D
h
h
--blah
+10
View File
@@ -28,3 +28,13 @@ a=0123456789
echo ${a:1}
echo ${a: -1}
echo ${a: ${#a}-1}
# problem with bash through 3.2.33
oIFS="$IFS"
IFS=$'\n'
a=(A B C D)
b=("${a[@]}")
echo "${#b[@]}", "${b[@]}" # 4, A B C D -- OK
b=("${a[@]:2}")
echo "${#b[@]}", "${b[@]}" # 1, C D -- bug, should be 2, C D
IFS="$oIFS"