mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-10 05:30:49 +02:00
commit bash-20110930 snapshot
This commit is contained in:
@@ -12227,3 +12227,63 @@ doc/{bash.1,bashref.texi}
|
||||
- formatting and some content changes from Benno Schulenberg
|
||||
<bensberg@justemail.net>
|
||||
- document new posix-mode behavior from interp 383 change of 9/22
|
||||
|
||||
9/30
|
||||
----
|
||||
execute_cmd.c
|
||||
- shell_execve: add strerror to error message about executable file
|
||||
that shell can't execute as a shell script. From suggestion by
|
||||
daysleeper <daysleeper@centrum.cz>
|
||||
|
||||
10/1
|
||||
----
|
||||
bashhist.c
|
||||
- maybe_add_history: act as if literal_history is set when parser_state
|
||||
includes PST_HEREDOC, so we save the bodies of here-documents just
|
||||
as they were entered. Fixes bug reported by Jonathan Wakely
|
||||
<bugs@kayari.org>
|
||||
- bash_add_history: make sure that the second and subsequent lines of
|
||||
a here document don't have extra newlines or other delimiting
|
||||
chars added, since they have the trailing newline preserved, when
|
||||
`lithist' is set and history_delimiting_chars isn't called
|
||||
|
||||
execute_cmd.c
|
||||
- execute_command_internal: avoid fd exhaustion caused by using
|
||||
process substitution in loops inside shell functions by using
|
||||
copy_fifo_list and close_new_fifos (). Fixes debian bash bug
|
||||
642504
|
||||
|
||||
lib/readline/complete.c
|
||||
- new variable, rl_filename_stat_hook, used by append_to_match. If
|
||||
filename completion is desired, and rl_filename_stat_hook points
|
||||
to a function, call that function to expand the filename in an
|
||||
application-specific way before calling stat.
|
||||
|
||||
bashline.c
|
||||
- bash_default_completion: if variable completion returns a single
|
||||
match, use bash_filename_stat_hook and file_isdir to determine
|
||||
whether or not the variable name expands to a directory. If it
|
||||
does, set the filename_append_character to `/'. This is not
|
||||
perfect, so we will see how it works out. Adds functionality
|
||||
requested by Peter Toft <pto@linuxbog.dk> and Patrick Pfeifer
|
||||
<patrick@pfeifer.de>
|
||||
- rl_filename_stat_hook: assigned bash_filename_stat_hook, so things
|
||||
like $HOME/Downloads (after completion) have a slash appended.
|
||||
In general, this causes the stat hook to be called whenever
|
||||
filename completion is appended. Adds functionality requested by
|
||||
Patrick Pfeifer <patrick@pfeifer.de>
|
||||
|
||||
lib/readline/readline.h
|
||||
- new extern declaration for rl_filename_stat_hook
|
||||
|
||||
lib/readline/doc/rltech.texi
|
||||
- rl_directory_rewrite_hook: now documented
|
||||
- rl_filename_stat_hook: document
|
||||
|
||||
pcomplete.c
|
||||
- gen_action_completions: in the CA_DIRECTORY case, turn off
|
||||
rl_filename_completion_desired if it was off before we called
|
||||
rl_filename_completion_function and we didn't get any matches.
|
||||
Having it on causes readline to quote the matches as if they
|
||||
were filenames. Adds functionality requested by many,
|
||||
including Clark Wang <dearvoid@gmail.com>
|
||||
|
||||
@@ -12226,3 +12226,63 @@ execute_command.c
|
||||
doc/{bash.1,bashref.texi}
|
||||
- formatting and some content changes from Benno Schulenberg
|
||||
<bensberg@justemail.net>
|
||||
- document new posix-mode behavior from interp 383 change of 9/22
|
||||
|
||||
9/30
|
||||
----
|
||||
execute_cmd.c
|
||||
- shell_execve: add strerror to error message about executable file
|
||||
that shell can't execute as a shell script. From suggestion by
|
||||
daysleeper <daysleeper@centrum.cz>
|
||||
|
||||
10/1
|
||||
----
|
||||
bashhist.c
|
||||
- maybe_add_history: act as if literal_history is set when parser_state
|
||||
includes PST_HEREDOC, so we save the bodies of here-documents just
|
||||
as they were entered. Fixes bug reported by Jonathan Wakely
|
||||
<bugs@kayari.org>
|
||||
- bash_add_history: make sure that the second and subsequent lines of
|
||||
a here document don't have extra newlines or other delimiting
|
||||
chars added, since they have the trailing newline preserved, when
|
||||
`lithist' is set and history_delimiting_chars isn't called
|
||||
|
||||
execute_cmd.c
|
||||
- execute_command_internal: avoid fd exhaustion caused by using
|
||||
process substitution in loops inside shell functions by using
|
||||
copy_fifo_list and close_new_fifos (). Fixes debian bash bug
|
||||
642504
|
||||
|
||||
lib/readline/complete.c
|
||||
- new variable, rl_filename_stat_hook, used by append_to_match. If
|
||||
filename completion is desired, and rl_filename_stat_hook points
|
||||
to a function, call that function to expand the filename in an
|
||||
application-specific way before calling stat.
|
||||
|
||||
bashline.c
|
||||
- bash_default_completion: if variable completion returns a single
|
||||
match, use bash_filename_stat_hook and file_isdir to determine
|
||||
whether or not the variable name expands to a directory. If it
|
||||
does, set the filename_append_character to `/'. This is not
|
||||
perfect, so we will see how it works out. Adds functionality
|
||||
requested by Peter Toft <pto@linuxbog.dk> and Patrick Pfeifer
|
||||
<patrick@pfeifer.de>
|
||||
- rl_filename_stat_hook: assigned bash_filename_stat_hook, so things
|
||||
like $HOME/Downloads (after completion) have a slash appended.
|
||||
In general, this causes the stat hook to be called whenever
|
||||
filename completion is appended. Adds functionality requested by
|
||||
Patrick Pfeifer <patrick@pfeifer.de>
|
||||
|
||||
lib/readline/readline.h
|
||||
- new extern declaration for rl_filename_stat_hook
|
||||
|
||||
lib/readline/doc/rltech.texi
|
||||
- rl_directory_rewrite_hook: now documented
|
||||
- rl_filename_stat_hook: document
|
||||
|
||||
pcomplete.c
|
||||
- gen_action_completions: in the CA_DIRECTORY case, turn off
|
||||
rl_filename_completion_desired if it was off before we called
|
||||
rl_filename_completion_function and we didn't get any matches.
|
||||
Having it on causes readline to quote the matches as if they
|
||||
were filenames.
|
||||
|
||||
+19
-6
@@ -1,6 +1,6 @@
|
||||
/* bashhist.c -- bash interface to the GNU history library. */
|
||||
|
||||
/* Copyright (C) 1993-2010 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993-2011 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
@@ -649,8 +649,11 @@ hc_erasedups (line)
|
||||
commenting out the rest of the command when the entire command is saved as
|
||||
a single history entry (when COMMAND_ORIENTED_HISTORY is enabled). If
|
||||
LITERAL_HISTORY is set, we're saving lines in the history with embedded
|
||||
newlines, so it's OK to save comment lines. We also make sure to save
|
||||
multiple-line quoted strings or other constructs. */
|
||||
newlines, so it's OK to save comment lines. If we're collecting the body
|
||||
of a here-document, we should act as if literal_history is enabled, because
|
||||
we want to save the entire contents of the here-document as it was
|
||||
entered. We also make sure to save multiple-line quoted strings or other
|
||||
constructs. */
|
||||
void
|
||||
maybe_add_history (line)
|
||||
char *line;
|
||||
@@ -663,7 +666,7 @@ maybe_add_history (line)
|
||||
if (current_command_line_count > 1)
|
||||
{
|
||||
if (current_command_first_line_saved &&
|
||||
(literal_history || dstack.delimiter_depth != 0 || shell_comment (line) == 0))
|
||||
((parser_state & PST_HEREDOC) || literal_history || dstack.delimiter_depth != 0 || shell_comment (line) == 0))
|
||||
bash_add_history (line);
|
||||
return;
|
||||
}
|
||||
@@ -736,7 +739,17 @@ bash_add_history (line)
|
||||
add_it = 1;
|
||||
if (command_oriented_history && current_command_line_count > 1)
|
||||
{
|
||||
chars_to_add = literal_history ? "\n" : history_delimiting_chars (line);
|
||||
/* The second and subsequent lines of a here document have the trailing
|
||||
newline preserved. We don't want to add extra newlines here, but we
|
||||
do want to add one after the first line (which is the command that
|
||||
contains the here-doc specifier). parse.y:history_delimiting_chars()
|
||||
does the right thing to take care of this for us. We don't want to
|
||||
add extra newlines if the user chooses to enable literal_history,
|
||||
so we have to duplicate some of what that function does here. */
|
||||
if ((parser_state & PST_HEREDOC) && literal_history && current_command_line_count > 2 && line[strlen (line) - 1] == '\n')
|
||||
chars_to_add = "";
|
||||
else
|
||||
chars_to_add = literal_history ? "\n" : history_delimiting_chars (line);
|
||||
|
||||
using_history ();
|
||||
current = previous_history ();
|
||||
|
||||
+923
@@ -0,0 +1,923 @@
|
||||
/* bashhist.c -- bash interface to the GNU history library. */
|
||||
|
||||
/* Copyright (C) 1993-2011 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 (HISTORY)
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "bashtypes.h"
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "bashansi.h"
|
||||
#include "posixstat.h"
|
||||
#include "filecntl.h"
|
||||
|
||||
#include "bashintl.h"
|
||||
|
||||
#if defined (SYSLOG_HISTORY)
|
||||
# include <syslog.h>
|
||||
#endif
|
||||
|
||||
#include "shell.h"
|
||||
#include "flags.h"
|
||||
#include "input.h"
|
||||
#include "parser.h" /* for the struct dstack stuff. */
|
||||
#include "pathexp.h" /* for the struct ignorevar stuff */
|
||||
#include "bashhist.h" /* matching prototypes and declarations */
|
||||
#include "builtins/common.h"
|
||||
|
||||
#include <readline/history.h>
|
||||
#include <glob/glob.h>
|
||||
#include <glob/strmatch.h>
|
||||
|
||||
#if defined (READLINE)
|
||||
# include "bashline.h"
|
||||
extern int rl_done, rl_dispatching; /* should really include readline.h */
|
||||
#endif
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
static int histignore_item_func __P((struct ign *));
|
||||
static int check_history_control __P((char *));
|
||||
static void hc_erasedups __P((char *));
|
||||
static void really_add_history __P((char *));
|
||||
|
||||
static struct ignorevar histignore =
|
||||
{
|
||||
"HISTIGNORE",
|
||||
(struct ign *)0,
|
||||
0,
|
||||
(char *)0,
|
||||
(sh_iv_item_func_t *)histignore_item_func,
|
||||
};
|
||||
|
||||
#define HIGN_EXPAND 0x01
|
||||
|
||||
/* Declarations of bash history variables. */
|
||||
/* Non-zero means to remember lines typed to the shell on the history
|
||||
list. This is different than the user-controlled behaviour; this
|
||||
becomes zero when we read lines from a file, for example. */
|
||||
int remember_on_history = 1;
|
||||
int enable_history_list = 1; /* value for `set -o history' */
|
||||
|
||||
/* The number of lines that Bash has added to this history session. The
|
||||
difference between the number of the top element in the history list
|
||||
(offset from history_base) and the number of lines in the history file.
|
||||
Appending this session's history to the history file resets this to 0. */
|
||||
int history_lines_this_session;
|
||||
|
||||
/* The number of lines that Bash has read from the history file. */
|
||||
int history_lines_in_file;
|
||||
|
||||
#if defined (BANG_HISTORY)
|
||||
/* Non-zero means do no history expansion on this line, regardless
|
||||
of what history_expansion says. */
|
||||
int history_expansion_inhibited;
|
||||
#endif
|
||||
|
||||
/* With the old default, every line was saved in the history individually.
|
||||
I.e., if the user enters:
|
||||
bash$ for i in a b c
|
||||
> do
|
||||
> echo $i
|
||||
> done
|
||||
Each line will be individually saved in the history.
|
||||
bash$ history
|
||||
10 for i in a b c
|
||||
11 do
|
||||
12 echo $i
|
||||
13 done
|
||||
14 history
|
||||
If the variable command_oriented_history is set, multiple lines
|
||||
which form one command will be saved as one history entry.
|
||||
bash$ for i in a b c
|
||||
> do
|
||||
> echo $i
|
||||
> done
|
||||
bash$ history
|
||||
10 for i in a b c
|
||||
do
|
||||
echo $i
|
||||
done
|
||||
11 history
|
||||
The user can then recall the whole command all at once instead
|
||||
of just being able to recall one line at a time.
|
||||
|
||||
This is now enabled by default.
|
||||
*/
|
||||
int command_oriented_history = 1;
|
||||
|
||||
/* Set to 1 if the first line of a possibly-multi-line command was saved
|
||||
in the history list. Managed by maybe_add_history(), but global so
|
||||
the history-manipluating builtins can see it. */
|
||||
int current_command_first_line_saved = 0;
|
||||
|
||||
/* Non-zero means to store newlines in the history list when using
|
||||
command_oriented_history rather than trying to use semicolons. */
|
||||
int literal_history;
|
||||
|
||||
/* Non-zero means to append the history to the history file at shell
|
||||
exit, even if the history has been stifled. */
|
||||
int force_append_history;
|
||||
|
||||
/* A nit for picking at history saving. Flags have the following values:
|
||||
|
||||
Value == 0 means save all lines parsed by the shell on the history.
|
||||
Value & HC_IGNSPACE means save all lines that do not start with a space.
|
||||
Value & HC_IGNDUPS means save all lines that do not match the last
|
||||
line saved.
|
||||
Value & HC_ERASEDUPS means to remove all other matching lines from the
|
||||
history list before saving the latest line. */
|
||||
int history_control;
|
||||
|
||||
/* Set to 1 if the last command was added to the history list successfully
|
||||
as a separate history entry; set to 0 if the line was ignored or added
|
||||
to a previous entry as part of command-oriented-history processing. */
|
||||
int hist_last_line_added;
|
||||
|
||||
/* Set to 1 if builtins/history.def:push_history added the last history
|
||||
entry. */
|
||||
int hist_last_line_pushed;
|
||||
|
||||
#if defined (READLINE)
|
||||
/* If non-zero, and readline is being used, the user is offered the
|
||||
chance to re-edit a failed history expansion. */
|
||||
int history_reediting;
|
||||
|
||||
/* If non-zero, and readline is being used, don't directly execute a
|
||||
line with history substitution. Reload it into the editing buffer
|
||||
instead and let the user further edit and confirm with a newline. */
|
||||
int hist_verify;
|
||||
|
||||
#endif /* READLINE */
|
||||
|
||||
/* Non-zero means to not save function definitions in the history list. */
|
||||
int dont_save_function_defs;
|
||||
|
||||
/* Variables declared in other files used here. */
|
||||
extern int current_command_line_count;
|
||||
|
||||
extern struct dstack dstack;
|
||||
extern int parser_state;
|
||||
|
||||
static int bash_history_inhibit_expansion __P((char *, int));
|
||||
#if defined (READLINE)
|
||||
static void re_edit __P((char *));
|
||||
#endif
|
||||
static int history_expansion_p __P((char *));
|
||||
static int shell_comment __P((char *));
|
||||
static int should_expand __P((char *));
|
||||
static HIST_ENTRY *last_history_entry __P((void));
|
||||
static char *expand_histignore_pattern __P((char *));
|
||||
static int history_should_ignore __P((char *));
|
||||
|
||||
/* Is the history expansion starting at string[i] one that should not
|
||||
be expanded? */
|
||||
static int
|
||||
bash_history_inhibit_expansion (string, i)
|
||||
char *string;
|
||||
int i;
|
||||
{
|
||||
/* The shell uses ! as a pattern negation character in globbing [...]
|
||||
expressions, so let those pass without expansion. */
|
||||
if (i > 0 && (string[i - 1] == '[') && member (']', string + i + 1))
|
||||
return (1);
|
||||
/* The shell uses ! as the indirect expansion character, so let those
|
||||
expansions pass as well. */
|
||||
else if (i > 1 && string[i - 1] == '{' && string[i - 2] == '$' &&
|
||||
member ('}', string + i + 1))
|
||||
return (1);
|
||||
/* The shell uses $! as a defined parameter expansion. */
|
||||
else if (i > 1 && string[i - 1] == '$' && string[i] == '!')
|
||||
return (1);
|
||||
#if defined (EXTENDED_GLOB)
|
||||
else if (extended_glob && i > 1 && string[i+1] == '(' && member (')', string + i + 2))
|
||||
return (1);
|
||||
#endif
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
bash_initialize_history ()
|
||||
{
|
||||
history_quotes_inhibit_expansion = 1;
|
||||
history_search_delimiter_chars = ";&()|<>";
|
||||
history_inhibit_expansion_function = bash_history_inhibit_expansion;
|
||||
#if defined (BANG_HISTORY)
|
||||
sv_histchars ("histchars");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
bash_history_reinit (interact)
|
||||
int interact;
|
||||
{
|
||||
#if defined (BANG_HISTORY)
|
||||
history_expansion = interact != 0;
|
||||
history_expansion_inhibited = 1;
|
||||
#endif
|
||||
remember_on_history = enable_history_list = interact != 0;
|
||||
history_inhibit_expansion_function = bash_history_inhibit_expansion;
|
||||
}
|
||||
|
||||
void
|
||||
bash_history_disable ()
|
||||
{
|
||||
remember_on_history = 0;
|
||||
#if defined (BANG_HISTORY)
|
||||
history_expansion_inhibited = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
bash_history_enable ()
|
||||
{
|
||||
remember_on_history = 1;
|
||||
#if defined (BANG_HISTORY)
|
||||
history_expansion_inhibited = 0;
|
||||
#endif
|
||||
history_inhibit_expansion_function = bash_history_inhibit_expansion;
|
||||
sv_history_control ("HISTCONTROL");
|
||||
sv_histignore ("HISTIGNORE");
|
||||
}
|
||||
|
||||
/* Load the history list from the history file. */
|
||||
void
|
||||
load_history ()
|
||||
{
|
||||
char *hf;
|
||||
|
||||
/* Truncate history file for interactive shells which desire it.
|
||||
Note that the history file is automatically truncated to the
|
||||
size of HISTSIZE if the user does not explicitly set the size
|
||||
differently. */
|
||||
set_if_not ("HISTSIZE", "500");
|
||||
sv_histsize ("HISTSIZE");
|
||||
|
||||
set_if_not ("HISTFILESIZE", get_string_value ("HISTSIZE"));
|
||||
sv_histsize ("HISTFILESIZE");
|
||||
|
||||
/* Read the history in HISTFILE into the history list. */
|
||||
hf = get_string_value ("HISTFILE");
|
||||
|
||||
if (hf && *hf && file_exists (hf))
|
||||
{
|
||||
read_history (hf);
|
||||
using_history ();
|
||||
history_lines_in_file = where_history ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bash_clear_history ()
|
||||
{
|
||||
clear_history ();
|
||||
history_lines_this_session = 0;
|
||||
}
|
||||
|
||||
/* Delete and free the history list entry at offset I. */
|
||||
int
|
||||
bash_delete_histent (i)
|
||||
int i;
|
||||
{
|
||||
HIST_ENTRY *discard;
|
||||
|
||||
discard = remove_history (i);
|
||||
if (discard)
|
||||
free_history_entry (discard);
|
||||
history_lines_this_session--;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
bash_delete_last_history ()
|
||||
{
|
||||
register int i;
|
||||
HIST_ENTRY **hlist, *histent;
|
||||
int r;
|
||||
|
||||
hlist = history_list ();
|
||||
if (hlist == NULL)
|
||||
return 0;
|
||||
|
||||
for (i = 0; hlist[i]; i++)
|
||||
;
|
||||
i--;
|
||||
|
||||
/* History_get () takes a parameter that must be offset by history_base. */
|
||||
histent = history_get (history_base + i); /* Don't free this */
|
||||
if (histent == NULL)
|
||||
return 0;
|
||||
|
||||
r = bash_delete_histent (i);
|
||||
|
||||
if (where_history () > history_length)
|
||||
history_set_pos (history_length);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_UNUSED
|
||||
/* Write the existing history out to the history file. */
|
||||
void
|
||||
save_history ()
|
||||
{
|
||||
char *hf;
|
||||
int r;
|
||||
|
||||
hf = get_string_value ("HISTFILE");
|
||||
if (hf && *hf && file_exists (hf))
|
||||
{
|
||||
/* Append only the lines that occurred this session to
|
||||
the history file. */
|
||||
using_history ();
|
||||
|
||||
if (history_lines_this_session <= where_history () || force_append_history)
|
||||
r = append_history (history_lines_this_session, hf);
|
||||
else
|
||||
r = write_history (hf);
|
||||
sv_histsize ("HISTFILESIZE");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
maybe_append_history (filename)
|
||||
char *filename;
|
||||
{
|
||||
int fd, result;
|
||||
struct stat buf;
|
||||
|
||||
result = EXECUTION_SUCCESS;
|
||||
if (history_lines_this_session && (history_lines_this_session <= where_history ()))
|
||||
{
|
||||
/* If the filename was supplied, then create it if necessary. */
|
||||
if (stat (filename, &buf) == -1 && errno == ENOENT)
|
||||
{
|
||||
fd = open (filename, O_WRONLY|O_CREAT, 0600);
|
||||
if (fd < 0)
|
||||
{
|
||||
builtin_error (_("%s: cannot create: %s"), filename, strerror (errno));
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
close (fd);
|
||||
}
|
||||
result = append_history (history_lines_this_session, filename);
|
||||
history_lines_in_file += history_lines_this_session;
|
||||
history_lines_this_session = 0;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* If this is an interactive shell, then append the lines executed
|
||||
this session to the history file. */
|
||||
int
|
||||
maybe_save_shell_history ()
|
||||
{
|
||||
int result;
|
||||
char *hf;
|
||||
|
||||
result = 0;
|
||||
if (history_lines_this_session)
|
||||
{
|
||||
hf = get_string_value ("HISTFILE");
|
||||
|
||||
if (hf && *hf)
|
||||
{
|
||||
/* If the file doesn't exist, then create it. */
|
||||
if (file_exists (hf) == 0)
|
||||
{
|
||||
int file;
|
||||
file = open (hf, O_CREAT | O_TRUNC | O_WRONLY, 0600);
|
||||
if (file != -1)
|
||||
close (file);
|
||||
}
|
||||
|
||||
/* Now actually append the lines if the history hasn't been
|
||||
stifled. If the history has been stifled, rewrite the
|
||||
history file. */
|
||||
using_history ();
|
||||
if (history_lines_this_session <= where_history () || force_append_history)
|
||||
{
|
||||
result = append_history (history_lines_this_session, hf);
|
||||
history_lines_in_file += history_lines_this_session;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = write_history (hf);
|
||||
history_lines_in_file = history_lines_this_session;
|
||||
}
|
||||
history_lines_this_session = 0;
|
||||
|
||||
sv_histsize ("HISTFILESIZE");
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
#if defined (READLINE)
|
||||
/* Tell readline () that we have some text for it to edit. */
|
||||
static void
|
||||
re_edit (text)
|
||||
char *text;
|
||||
{
|
||||
if (bash_input.type == st_stdin)
|
||||
bash_re_edit (text);
|
||||
}
|
||||
#endif /* READLINE */
|
||||
|
||||
/* Return 1 if this line needs history expansion. */
|
||||
static int
|
||||
history_expansion_p (line)
|
||||
char *line;
|
||||
{
|
||||
register char *s;
|
||||
|
||||
for (s = line; *s; s++)
|
||||
if (*s == history_expansion_char || *s == history_subst_char)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Do pre-processing on LINE. If PRINT_CHANGES is non-zero, then
|
||||
print the results of expanding the line if there were any changes.
|
||||
If there is an error, return NULL, otherwise the expanded line is
|
||||
returned. If ADDIT is non-zero the line is added to the history
|
||||
list after history expansion. ADDIT is just a suggestion;
|
||||
REMEMBER_ON_HISTORY can veto, and does.
|
||||
Right now this does history expansion. */
|
||||
char *
|
||||
pre_process_line (line, print_changes, addit)
|
||||
char *line;
|
||||
int print_changes, addit;
|
||||
{
|
||||
char *history_value;
|
||||
char *return_value;
|
||||
int expanded;
|
||||
|
||||
return_value = line;
|
||||
expanded = 0;
|
||||
|
||||
# if defined (BANG_HISTORY)
|
||||
/* History expand the line. If this results in no errors, then
|
||||
add that line to the history if ADDIT is non-zero. */
|
||||
if (!history_expansion_inhibited && history_expansion && history_expansion_p (line))
|
||||
{
|
||||
expanded = history_expand (line, &history_value);
|
||||
|
||||
if (expanded)
|
||||
{
|
||||
if (print_changes)
|
||||
{
|
||||
if (expanded < 0)
|
||||
internal_error ("%s", history_value);
|
||||
#if defined (READLINE)
|
||||
else if (hist_verify == 0 || expanded == 2)
|
||||
#else
|
||||
else
|
||||
#endif
|
||||
fprintf (stderr, "%s\n", history_value);
|
||||
}
|
||||
|
||||
/* If there was an error, return NULL. */
|
||||
if (expanded < 0 || expanded == 2) /* 2 == print only */
|
||||
{
|
||||
# if defined (READLINE)
|
||||
if (expanded == 2 && rl_dispatching == 0 && *history_value)
|
||||
# else
|
||||
if (expanded == 2 && *history_value)
|
||||
# endif /* !READLINE */
|
||||
maybe_add_history (history_value);
|
||||
|
||||
free (history_value);
|
||||
|
||||
# if defined (READLINE)
|
||||
/* New hack. We can allow the user to edit the
|
||||
failed history expansion. */
|
||||
if (history_reediting && expanded < 0 && rl_done)
|
||||
re_edit (line);
|
||||
# endif /* READLINE */
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
# if defined (READLINE)
|
||||
if (hist_verify && expanded == 1)
|
||||
{
|
||||
re_edit (history_value);
|
||||
return ((char *)NULL);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
/* Let other expansions know that return_value can be free'ed,
|
||||
and that a line has been added to the history list. Note
|
||||
that we only add lines that have something in them. */
|
||||
expanded = 1;
|
||||
return_value = history_value;
|
||||
}
|
||||
# endif /* BANG_HISTORY */
|
||||
|
||||
if (addit && remember_on_history && *return_value)
|
||||
maybe_add_history (return_value);
|
||||
|
||||
#if 0
|
||||
if (expanded == 0)
|
||||
return_value = savestring (line);
|
||||
#endif
|
||||
|
||||
return (return_value);
|
||||
}
|
||||
|
||||
/* Return 1 if the first non-whitespace character in LINE is a `#', indicating
|
||||
* that the line is a shell comment. */
|
||||
static int
|
||||
shell_comment (line)
|
||||
char *line;
|
||||
{
|
||||
char *p;
|
||||
|
||||
for (p = line; p && *p && whitespace (*p); p++)
|
||||
;
|
||||
return (p && *p == '#');
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_UNUSED
|
||||
/* Remove shell comments from LINE. A `#' and anything after it is a comment.
|
||||
This isn't really useful yet, since it doesn't handle quoting. */
|
||||
static char *
|
||||
filter_comments (line)
|
||||
char *line;
|
||||
{
|
||||
char *p;
|
||||
|
||||
for (p = line; p && *p && *p != '#'; p++)
|
||||
;
|
||||
if (p && *p == '#')
|
||||
*p = '\0';
|
||||
return (line);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Check LINE against what HISTCONTROL says to do. Returns 1 if the line
|
||||
should be saved; 0 if it should be discarded. */
|
||||
static int
|
||||
check_history_control (line)
|
||||
char *line;
|
||||
{
|
||||
HIST_ENTRY *temp;
|
||||
int r;
|
||||
|
||||
if (history_control == 0)
|
||||
return 1;
|
||||
|
||||
/* ignorespace or ignoreboth */
|
||||
if ((history_control & HC_IGNSPACE) && *line == ' ')
|
||||
return 0;
|
||||
|
||||
/* ignoredups or ignoreboth */
|
||||
if (history_control & HC_IGNDUPS)
|
||||
{
|
||||
using_history ();
|
||||
temp = previous_history ();
|
||||
|
||||
r = (temp == 0 || STREQ (temp->line, line) == 0);
|
||||
|
||||
using_history ();
|
||||
|
||||
if (r == 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Remove all entries matching LINE from the history list. Triggered when
|
||||
HISTCONTROL includes `erasedups'. */
|
||||
static void
|
||||
hc_erasedups (line)
|
||||
char *line;
|
||||
{
|
||||
HIST_ENTRY *temp;
|
||||
int r;
|
||||
|
||||
using_history ();
|
||||
while (temp = previous_history ())
|
||||
{
|
||||
if (STREQ (temp->line, line))
|
||||
{
|
||||
r = where_history ();
|
||||
remove_history (r);
|
||||
}
|
||||
}
|
||||
using_history ();
|
||||
}
|
||||
|
||||
/* Add LINE to the history list, handling possibly multi-line compound
|
||||
commands. We note whether or not we save the first line of each command
|
||||
(which is usually the entire command and history entry), and don't add
|
||||
the second and subsequent lines of a multi-line compound command if we
|
||||
didn't save the first line. We don't usually save shell comment lines in
|
||||
compound commands in the history, because they could have the effect of
|
||||
commenting out the rest of the command when the entire command is saved as
|
||||
a single history entry (when COMMAND_ORIENTED_HISTORY is enabled). If
|
||||
LITERAL_HISTORY is set, we're saving lines in the history with embedded
|
||||
newlines, so it's OK to save comment lines. If we're collecting the body
|
||||
of a here-document, we should act as if literal_history is enabled, because
|
||||
we want to save the entire contents of the here-document as it was
|
||||
entered. We also make sure to save multiple-line quoted strings or other
|
||||
constructs. */
|
||||
void
|
||||
maybe_add_history (line)
|
||||
char *line;
|
||||
{
|
||||
hist_last_line_added = 0;
|
||||
|
||||
/* Don't use the value of history_control to affect the second
|
||||
and subsequent lines of a multi-line command (old code did
|
||||
this only when command_oriented_history is enabled). */
|
||||
if (current_command_line_count > 1)
|
||||
{
|
||||
if (current_command_first_line_saved &&
|
||||
((parser_state & PST_HEREDOC) || literal_history || dstack.delimiter_depth != 0 || shell_comment (line) == 0))
|
||||
bash_add_history (line);
|
||||
return;
|
||||
}
|
||||
|
||||
/* This is the first line of a (possible multi-line) command. Note whether
|
||||
or not we should save the first line and remember it. */
|
||||
current_command_first_line_saved = check_add_history (line, 0);
|
||||
}
|
||||
|
||||
/* Just check LINE against HISTCONTROL and HISTIGNORE and add it to the
|
||||
history if it's OK. Used by `history -s' as well as maybe_add_history().
|
||||
Returns 1 if the line was saved in the history, 0 otherwise. */
|
||||
int
|
||||
check_add_history (line, force)
|
||||
char *line;
|
||||
int force;
|
||||
{
|
||||
if (check_history_control (line) && history_should_ignore (line) == 0)
|
||||
{
|
||||
/* We're committed to saving the line. If the user has requested it,
|
||||
remove other matching lines from the history. */
|
||||
if (history_control & HC_ERASEDUPS)
|
||||
hc_erasedups (line);
|
||||
|
||||
if (force)
|
||||
{
|
||||
really_add_history (line);
|
||||
using_history ();
|
||||
}
|
||||
else
|
||||
bash_add_history (line);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined (SYSLOG_HISTORY)
|
||||
#define SYSLOG_MAXLEN 600
|
||||
|
||||
void
|
||||
bash_syslog_history (line)
|
||||
const char *line;
|
||||
{
|
||||
char trunc[SYSLOG_MAXLEN];
|
||||
|
||||
if (strlen(line) < SYSLOG_MAXLEN)
|
||||
syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "HISTORY: PID=%d UID=%d %s", getpid(), current_user.uid, line);
|
||||
else
|
||||
{
|
||||
strncpy (trunc, line, SYSLOG_MAXLEN);
|
||||
trunc[SYSLOG_MAXLEN - 1] = '\0';
|
||||
syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "HISTORY (TRUNCATED): PID=%d UID=%d %s", getpid(), current_user.uid, trunc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Add a line to the history list.
|
||||
The variable COMMAND_ORIENTED_HISTORY controls the style of history
|
||||
remembering; when non-zero, and LINE is not the first line of a
|
||||
complete parser construct, append LINE to the last history line instead
|
||||
of adding it as a new line. */
|
||||
void
|
||||
bash_add_history (line)
|
||||
char *line;
|
||||
{
|
||||
int add_it, offset, curlen;
|
||||
HIST_ENTRY *current, *old;
|
||||
char *chars_to_add, *new_line;
|
||||
|
||||
add_it = 1;
|
||||
if (command_oriented_history && current_command_line_count > 1)
|
||||
{
|
||||
/* The second and subsequent lines of a here document have the trailing
|
||||
newline preserved. We don't want to add extra newlines here, but we
|
||||
do want to add one after the first line (which is the command that
|
||||
contains the here-doc specifier). parse.y:history_delimiting_chars()
|
||||
does the right thing to take care of this for us. We don't want to
|
||||
add extra newlines if the user chooses literal_history, so we have to
|
||||
duplicate some of what that function does here. */
|
||||
if ((parser_state & PST_HEREDOC) && literal_history && current_command_line_count > 2 && line[strlen (line) - 1] == '\n')
|
||||
chars_to_add = "";
|
||||
else
|
||||
chars_to_add = literal_history ? "\n" : history_delimiting_chars (line);
|
||||
|
||||
using_history ();
|
||||
current = previous_history ();
|
||||
|
||||
if (current)
|
||||
{
|
||||
/* If the previous line ended with an escaped newline (escaped
|
||||
with backslash, but otherwise unquoted), then remove the quoted
|
||||
newline, since that is what happens when the line is parsed. */
|
||||
curlen = strlen (current->line);
|
||||
|
||||
if (dstack.delimiter_depth == 0 && current->line[curlen - 1] == '\\' &&
|
||||
current->line[curlen - 2] != '\\')
|
||||
{
|
||||
current->line[curlen - 1] = '\0';
|
||||
curlen--;
|
||||
chars_to_add = "";
|
||||
}
|
||||
|
||||
/* If we're not in some kind of quoted construct, the current history
|
||||
entry ends with a newline, and we're going to add a semicolon,
|
||||
don't. In some cases, it results in a syntax error (e.g., before
|
||||
a close brace), and it should not be needed. */
|
||||
if (dstack.delimiter_depth == 0 && current->line[curlen - 1] == '\n' && *chars_to_add == ';')
|
||||
chars_to_add++;
|
||||
|
||||
new_line = (char *)xmalloc (1
|
||||
+ curlen
|
||||
+ strlen (line)
|
||||
+ strlen (chars_to_add));
|
||||
sprintf (new_line, "%s%s%s", current->line, chars_to_add, line);
|
||||
offset = where_history ();
|
||||
old = replace_history_entry (offset, new_line, current->data);
|
||||
free (new_line);
|
||||
|
||||
if (old)
|
||||
free_history_entry (old);
|
||||
|
||||
add_it = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (add_it)
|
||||
really_add_history (line);
|
||||
|
||||
#if defined (SYSLOG_HISTORY)
|
||||
bash_syslog_history (line);
|
||||
#endif
|
||||
|
||||
using_history ();
|
||||
}
|
||||
|
||||
static void
|
||||
really_add_history (line)
|
||||
char *line;
|
||||
{
|
||||
hist_last_line_added = 1;
|
||||
hist_last_line_pushed = 0;
|
||||
add_history (line);
|
||||
history_lines_this_session++;
|
||||
}
|
||||
|
||||
int
|
||||
history_number ()
|
||||
{
|
||||
using_history ();
|
||||
return (remember_on_history ? history_base + where_history () : 1);
|
||||
}
|
||||
|
||||
static int
|
||||
should_expand (s)
|
||||
char *s;
|
||||
{
|
||||
char *p;
|
||||
|
||||
for (p = s; p && *p; p++)
|
||||
{
|
||||
if (*p == '\\')
|
||||
p++;
|
||||
else if (*p == '&')
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
histignore_item_func (ign)
|
||||
struct ign *ign;
|
||||
{
|
||||
if (should_expand (ign->val))
|
||||
ign->flags |= HIGN_EXPAND;
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
setup_history_ignore (varname)
|
||||
char *varname;
|
||||
{
|
||||
setup_ignore_patterns (&histignore);
|
||||
}
|
||||
|
||||
static HIST_ENTRY *
|
||||
last_history_entry ()
|
||||
{
|
||||
HIST_ENTRY *he;
|
||||
|
||||
using_history ();
|
||||
he = previous_history ();
|
||||
using_history ();
|
||||
return he;
|
||||
}
|
||||
|
||||
char *
|
||||
last_history_line ()
|
||||
{
|
||||
HIST_ENTRY *he;
|
||||
|
||||
he = last_history_entry ();
|
||||
if (he == 0)
|
||||
return ((char *)NULL);
|
||||
return he->line;
|
||||
}
|
||||
|
||||
static char *
|
||||
expand_histignore_pattern (pat)
|
||||
char *pat;
|
||||
{
|
||||
HIST_ENTRY *phe;
|
||||
char *ret;
|
||||
|
||||
phe = last_history_entry ();
|
||||
|
||||
if (phe == (HIST_ENTRY *)0)
|
||||
return (savestring (pat));
|
||||
|
||||
ret = strcreplace (pat, '&', phe->line, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Return 1 if we should not put LINE into the history according to the
|
||||
patterns in HISTIGNORE. */
|
||||
static int
|
||||
history_should_ignore (line)
|
||||
char *line;
|
||||
{
|
||||
register int i, match;
|
||||
char *npat;
|
||||
|
||||
if (histignore.num_ignores == 0)
|
||||
return 0;
|
||||
|
||||
for (i = match = 0; i < histignore.num_ignores; i++)
|
||||
{
|
||||
if (histignore.ignores[i].flags & HIGN_EXPAND)
|
||||
npat = expand_histignore_pattern (histignore.ignores[i].val);
|
||||
else
|
||||
npat = histignore.ignores[i].val;
|
||||
|
||||
match = strmatch (npat, line, FNMATCH_EXTFLAG) != FNM_NOMATCH;
|
||||
|
||||
if (histignore.ignores[i].flags & HIGN_EXPAND)
|
||||
free (npat);
|
||||
|
||||
if (match)
|
||||
break;
|
||||
}
|
||||
|
||||
return match;
|
||||
}
|
||||
#endif /* HISTORY */
|
||||
+20
-3
@@ -527,6 +527,8 @@ initialize_readline ()
|
||||
|
||||
rl_filename_rewrite_hook = bash_filename_rewrite_hook;
|
||||
|
||||
rl_filename_stat_hook = bash_filename_stat_hook;
|
||||
|
||||
/* Tell the filename completer we want a chance to ignore some names. */
|
||||
rl_ignore_some_completions_function = filename_completion_ignore;
|
||||
|
||||
@@ -1464,7 +1466,7 @@ bash_default_completion (text, start, end, qc, compflags)
|
||||
const char *text;
|
||||
int start, end, qc, compflags;
|
||||
{
|
||||
char **matches;
|
||||
char **matches, *t;
|
||||
|
||||
matches = (char **)NULL;
|
||||
|
||||
@@ -1474,7 +1476,19 @@ bash_default_completion (text, start, end, qc, compflags)
|
||||
if (qc != '\'' && text[1] == '(') /* ) */
|
||||
matches = rl_completion_matches (text, command_subst_completion_function);
|
||||
else
|
||||
matches = rl_completion_matches (text, variable_completion_function);
|
||||
{
|
||||
matches = rl_completion_matches (text, variable_completion_function);
|
||||
if (matches && matches[0] && matches[1] == 0)
|
||||
{
|
||||
t = savestring (matches[0]);
|
||||
bash_filename_stat_hook (&t);
|
||||
/* doesn't use test_for_directory because that performs tilde
|
||||
expansion */
|
||||
if (file_isdir (t))
|
||||
rl_completion_append_character = '/';
|
||||
free (t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the word starts in `~', and there is no slash in the word, then
|
||||
@@ -2825,6 +2839,8 @@ restore_directory_hook (hookf)
|
||||
rl_directory_rewrite_hook = hookf;
|
||||
}
|
||||
|
||||
/* Expand a filename before the readline completion code passes it to stat(2).
|
||||
The filename will already have had tilde expansion performed. */
|
||||
static int
|
||||
bash_filename_stat_hook (dirname)
|
||||
char **dirname;
|
||||
@@ -2864,8 +2880,9 @@ bash_filename_stat_hook (dirname)
|
||||
*dirname = new_dirname;
|
||||
return_value = STREQ (local_dirname, *dirname) == 0;
|
||||
}
|
||||
else
|
||||
free (new_dirname);
|
||||
free (local_dirname);
|
||||
free (new_dirname);
|
||||
dispose_words (wl);
|
||||
}
|
||||
else
|
||||
|
||||
+51
-11
@@ -116,13 +116,15 @@ static int bash_backward_kill_shellword __P((int, int));
|
||||
static char *restore_tilde __P((char *, char *));
|
||||
|
||||
static char *bash_filename_rewrite_hook __P((char *, int));
|
||||
|
||||
static void bash_directory_expansion __P((char **));
|
||||
static int bash_filename_stat_hook __P((char **));
|
||||
static int bash_directory_completion_hook __P((char **));
|
||||
static int filename_completion_ignore __P((char **));
|
||||
static int bash_push_line __P((void));
|
||||
|
||||
static rl_icppfunc_t *save_directory_hook __P((void));
|
||||
static void reset_directory_hook __P((rl_icppfunc_t *));
|
||||
static void restore_directory_hook __P((rl_icppfunc_t));
|
||||
|
||||
static void cleanup_expansion_error __P((void));
|
||||
static void maybe_make_readline_line __P((char *));
|
||||
@@ -524,6 +526,9 @@ initialize_readline ()
|
||||
set_directory_hook ();
|
||||
|
||||
rl_filename_rewrite_hook = bash_filename_rewrite_hook;
|
||||
#if 0
|
||||
rl_filename_stat_hook = bash_filename_stat_hook;
|
||||
#endif
|
||||
|
||||
/* Tell the filename completer we want a chance to ignore some names. */
|
||||
rl_ignore_some_completions_function = filename_completion_ignore;
|
||||
@@ -847,12 +852,25 @@ hostnames_matching (text)
|
||||
/* The equivalent of the Korn shell C-o operate-and-get-next-history-line
|
||||
editing command. */
|
||||
static int saved_history_line_to_use = -1;
|
||||
static int last_saved_history_line = -1;
|
||||
|
||||
#define HISTORY_FULL() (history_is_stifled () && history_length >= history_max_entries)
|
||||
|
||||
static int
|
||||
set_saved_history ()
|
||||
{
|
||||
/* XXX - compensate for assumption that history was `shuffled' if it was
|
||||
actually not. */
|
||||
if (HISTORY_FULL () &&
|
||||
hist_last_line_added == 0 &&
|
||||
saved_history_line_to_use < history_length - 1)
|
||||
saved_history_line_to_use++;
|
||||
|
||||
if (saved_history_line_to_use >= 0)
|
||||
rl_get_previous_history (history_length - saved_history_line_to_use, 0);
|
||||
{
|
||||
rl_get_previous_history (history_length - saved_history_line_to_use, 0);
|
||||
last_saved_history_line = saved_history_line_to_use;
|
||||
}
|
||||
saved_history_line_to_use = -1;
|
||||
rl_startup_hook = old_rl_startup_hook;
|
||||
return (0);
|
||||
@@ -870,8 +888,7 @@ operate_and_get_next (count, c)
|
||||
/* Find the current line, and find the next line to use. */
|
||||
where = where_history ();
|
||||
|
||||
if ((history_is_stifled () && (history_length >= history_max_entries)) ||
|
||||
(where >= history_length - 1))
|
||||
if (HISTORY_FULL () || (where >= history_length - 1))
|
||||
saved_history_line_to_use = where;
|
||||
else
|
||||
saved_history_line_to_use = where + 1;
|
||||
@@ -1450,7 +1467,7 @@ bash_default_completion (text, start, end, qc, compflags)
|
||||
const char *text;
|
||||
int start, end, qc, compflags;
|
||||
{
|
||||
char **matches;
|
||||
char **matches, *t;
|
||||
|
||||
matches = (char **)NULL;
|
||||
|
||||
@@ -1460,7 +1477,19 @@ bash_default_completion (text, start, end, qc, compflags)
|
||||
if (qc != '\'' && text[1] == '(') /* ) */
|
||||
matches = rl_completion_matches (text, command_subst_completion_function);
|
||||
else
|
||||
matches = rl_completion_matches (text, variable_completion_function);
|
||||
{
|
||||
matches = rl_completion_matches (text, variable_completion_function);
|
||||
if (matches && matches[0] && matches[1] == 0)
|
||||
{
|
||||
t = savestring (matches[0]);
|
||||
bash_filename_stat_hook (&t);
|
||||
/* doesn't use test_for_directory because that performs tilde
|
||||
expansion */
|
||||
if (file_isdir (t))
|
||||
rl_completion_append_character = '/';
|
||||
free (t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the word starts in `~', and there is no slash in the word, then
|
||||
@@ -2811,8 +2840,10 @@ restore_directory_hook (hookf)
|
||||
rl_directory_rewrite_hook = hookf;
|
||||
}
|
||||
|
||||
/* Expand a filename before the readline completion code passes it to stat(2).
|
||||
The filename will already have had tilde expansion performed. */
|
||||
static int
|
||||
bash_directory_stat_hook (dirname)
|
||||
bash_filename_stat_hook (dirname)
|
||||
char **dirname;
|
||||
{
|
||||
char *local_dirname, *new_dirname, *t;
|
||||
@@ -2850,8 +2881,9 @@ bash_directory_stat_hook (dirname)
|
||||
*dirname = new_dirname;
|
||||
return_value = STREQ (local_dirname, *dirname) == 0;
|
||||
}
|
||||
else
|
||||
free (new_dirname);
|
||||
free (local_dirname);
|
||||
free (new_dirname);
|
||||
dispose_words (wl);
|
||||
}
|
||||
else
|
||||
@@ -3654,9 +3686,17 @@ bash_quote_filename (s, rtype, qcp)
|
||||
|
||||
/* Leave the opening quote intact. The readline completion code takes
|
||||
care of avoiding doubled opening quotes. */
|
||||
rlen = strlen (rtext);
|
||||
ret = (char *)xmalloc (rlen + 1);
|
||||
strcpy (ret, rtext);
|
||||
if (rtext)
|
||||
{
|
||||
rlen = strlen (rtext);
|
||||
ret = (char *)xmalloc (rlen + 1);
|
||||
strcpy (ret, rtext);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = (char *)xmalloc (rlen = 1);
|
||||
ret[0] = '\0';
|
||||
}
|
||||
|
||||
/* If there are multiple matches, cut off the closing quote. */
|
||||
if (rtype == MULT_MATCH && cs != COMPLETE_BSQUOTE)
|
||||
|
||||
+1273
-1250
File diff suppressed because it is too large
Load Diff
+165
-106
@@ -3,7 +3,7 @@
|
||||
</HEAD>
|
||||
<BODY><TABLE WIDTH=100%>
|
||||
<TR>
|
||||
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2011 July 7<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2011 September 25<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
</TR>
|
||||
</TABLE>
|
||||
<BR><A HREF="#index">Index</A>
|
||||
@@ -376,7 +376,7 @@ If any of the files exist but cannot be read,
|
||||
<B>bash</B>
|
||||
|
||||
reports an error.
|
||||
Tildes are expanded in file names as described below under
|
||||
Tildes are expanded in filenames as described below under
|
||||
<B>Tilde Expansion</B>
|
||||
|
||||
in the
|
||||
@@ -447,7 +447,7 @@ but the value of the
|
||||
<FONT SIZE=-1><B>PATH</B>
|
||||
|
||||
</FONT>
|
||||
variable is not used to search for the file name.
|
||||
variable is not used to search for the filename.
|
||||
<P>
|
||||
|
||||
If
|
||||
@@ -708,11 +708,12 @@ command (see
|
||||
|
||||
</FONT>
|
||||
below).
|
||||
If <B>|&</B> is used, the standard error of <I>command</I> is connected to
|
||||
<I>command2</I>'s standard input through the pipe; it is shorthand for
|
||||
<B>2>&1 |</B>.
|
||||
This implicit redirection of the standard error is performed after any
|
||||
redirections specified by the command.
|
||||
If <B>|&</B> is used, <I>command</I>'s standard output and standard error
|
||||
are connected to
|
||||
<I>command2</I>'s standard input through the pipe;
|
||||
it is shorthand for <B>2>&1 |</B>.
|
||||
This implicit redirection of the standard error is
|
||||
performed after any redirections specified by the command.
|
||||
<P>
|
||||
|
||||
The return status of a pipeline is the exit status of the last
|
||||
@@ -910,8 +911,9 @@ Expressions are composed of the primaries described below under
|
||||
|
||||
</FONT>
|
||||
Word splitting and pathname expansion are not performed on the words
|
||||
between the <B>[[</B> and <B>]]</B>; tilde expansion, parameter and
|
||||
variable expansion, arithmetic expansion, command substitution, process
|
||||
between the <B>[[</B> and <B>]]</B>; tilde expansion,
|
||||
parameter and variable expansion,
|
||||
arithmetic expansion, command substitution, process
|
||||
substitution, and quote removal are performed.
|
||||
Conditional operators such as <B>-f</B> must be unquoted to be recognized
|
||||
as primaries.
|
||||
@@ -1174,7 +1176,7 @@ If <I>NAME</I> is not supplied, the default name is <B>COPROC</B>.
|
||||
<I>NAME</I> must not be supplied if <I>command</I> is a <I>simple
|
||||
command</I> (see above); otherwise, it is interpreted as the first word
|
||||
of the simple command.
|
||||
When the coproc is executed, the shell creates an array variable (see
|
||||
When the coprocess is executed, the shell creates an array variable (see
|
||||
<B>Arrays</B>
|
||||
|
||||
below) named <I>NAME</I> in the context of the executing shell.
|
||||
@@ -1227,6 +1229,8 @@ That command is usually a <I>list</I> of commands between { and }, but
|
||||
may be any command listed under <B>Compound Commands</B> above.
|
||||
<I>compound-command</I> is executed whenever <I>name</I> is specified as the
|
||||
name of a simple command.
|
||||
When in <I>posix mode</I>, <I>name</I> may not be the name of one of the
|
||||
POSIX <I>special builtins</I>.
|
||||
Any redirections (see
|
||||
<FONT SIZE=-1><B>REDIRECTION</B>
|
||||
|
||||
@@ -1563,6 +1567,9 @@ and
|
||||
<B>local</B>
|
||||
|
||||
builtin commands.
|
||||
When in <I>posix mode</I>, these builtins may appear in a command after
|
||||
one or more instances of the <B>command</B> builtin and retain these
|
||||
assignment statement properties.
|
||||
<P>
|
||||
|
||||
In the context where an assignment statement is assigning a value
|
||||
@@ -1715,7 +1722,7 @@ option, then
|
||||
|
||||
is set to the first argument after the string to be
|
||||
executed, if one is present. Otherwise, it is set
|
||||
to the file name used to invoke
|
||||
to the filename used to invoke
|
||||
<B>bash</B>,
|
||||
|
||||
as given by argument zero.
|
||||
@@ -1746,7 +1753,7 @@ The following variables are set by the shell:
|
||||
<DT><B>BASH</B>
|
||||
|
||||
<DD>
|
||||
Expands to the full file name used to invoke this instance of
|
||||
Expands to the full filename used to invoke this instance of
|
||||
<B>bash</B>.
|
||||
|
||||
<DT><B>BASHOPTS</B>
|
||||
@@ -2349,11 +2356,11 @@ The value of
|
||||
|
||||
</FONT>
|
||||
is subjected to parameter expansion, command substitution, and arithmetic
|
||||
expansion before being interpreted as a file name.
|
||||
expansion before being interpreted as a filename.
|
||||
<FONT SIZE=-1><B>PATH</B>
|
||||
|
||||
</FONT>
|
||||
is not used to search for the resultant file name.
|
||||
is not used to search for the resultant filename.
|
||||
<DT><B>BASH_XTRACEFD</B>
|
||||
|
||||
<DD>
|
||||
@@ -2724,9 +2731,9 @@ greater than or equal to zero, the shell disables mail checking.
|
||||
<DT><B>MAILPATH</B>
|
||||
|
||||
<DD>
|
||||
A colon-separated list of file names to be checked for mail.
|
||||
A colon-separated list of filenames to be checked for mail.
|
||||
The message to be printed when mail arrives in a particular file
|
||||
may be specified by separating the file name from the message with a `?'.
|
||||
may be specified by separating the filename from the message with a `?'.
|
||||
When used in the text of the message, <B>$_</B> expands to the name of
|
||||
the current mailfile.
|
||||
Example:
|
||||
@@ -3059,7 +3066,7 @@ builtins. Each attribute applies to all members of an array.
|
||||
Arrays are assigned to using compound assignments of the form
|
||||
<I>name</I>=<B>(</B>value<I>1</I> ... value<I>n</I><B>)</B>, where each
|
||||
<I>value</I> is of the form [<I>subscript</I>]=<I>string</I>.
|
||||
Indexed array assignments do not require the bracket and subscript.
|
||||
Indexed array assignments do not require anything but <I>string</I>.
|
||||
When assigning to indexed arrays, if the optional brackets and subscript
|
||||
are supplied, that index is assigned to;
|
||||
otherwise the index of the element assigned is the last index assigned
|
||||
@@ -3387,7 +3394,7 @@ or the first
|
||||
<B>=</B>.
|
||||
|
||||
In these cases, tilde expansion is also performed.
|
||||
Consequently, one may use file names with tildes in assignments to
|
||||
Consequently, one may use filenames with tildes in assignments to
|
||||
<FONT SIZE=-1><B>PATH</B>,
|
||||
|
||||
</FONT>
|
||||
@@ -3981,13 +3988,13 @@ regarded as a
|
||||
<I>pattern</I>,
|
||||
|
||||
and replaced with an alphabetically sorted list of
|
||||
file names matching the pattern
|
||||
filenames matching the pattern
|
||||
(see
|
||||
<FONT SIZE=-1><B>Pattern Matching</B>
|
||||
|
||||
</FONT>
|
||||
below).
|
||||
If no matching file names are found,
|
||||
If no matching filenames are found,
|
||||
and the shell option
|
||||
<B>nullglob</B>
|
||||
|
||||
@@ -4046,19 +4053,19 @@ The
|
||||
<FONT SIZE=-1><B>GLOBIGNORE</B>
|
||||
|
||||
</FONT>
|
||||
shell variable may be used to restrict the set of file names matching a
|
||||
shell variable may be used to restrict the set of filenames matching a
|
||||
<I>pattern</I>.
|
||||
|
||||
If
|
||||
<FONT SIZE=-1><B>GLOBIGNORE</B>
|
||||
|
||||
</FONT>
|
||||
is set, each matching file name that also matches one of the patterns in
|
||||
is set, each matching filename that also matches one of the patterns in
|
||||
<FONT SIZE=-1><B>GLOBIGNORE</B>
|
||||
|
||||
</FONT>
|
||||
is removed from the list of matches.
|
||||
The file names
|
||||
The filenames
|
||||
<B>``.''</B>
|
||||
|
||||
and
|
||||
@@ -4075,11 +4082,11 @@ is set and not null. However, setting
|
||||
to a non-null value has the effect of enabling the
|
||||
<B>dotglob</B>
|
||||
|
||||
shell option, so all other file names beginning with a
|
||||
shell option, so all other filenames beginning with a
|
||||
<B>``.''</B>
|
||||
|
||||
will match.
|
||||
To get the old behavior of ignoring file names beginning with a
|
||||
To get the old behavior of ignoring filenames beginning with a
|
||||
<B>``.''</B>,
|
||||
|
||||
make
|
||||
@@ -4305,7 +4312,8 @@ Each redirection that may be preceded by a file descriptor number
|
||||
may instead be preceded by a word of the form {<I>varname</I>}.
|
||||
In this case, for each redirection operator except
|
||||
>&- and <&-, the shell will allocate a file descriptor greater
|
||||
than 10 and assign it to <I>varname</I>. If >&- or <&- is preceded
|
||||
than or equal to 10 and assign it to <I>varname</I>.
|
||||
If >&- or <&- is preceded
|
||||
by {<I>varname</I>}, the value of <I>varname</I> defines the file
|
||||
descriptor to close.
|
||||
<P>
|
||||
@@ -4323,9 +4331,10 @@ the redirection refers to the standard output (file descriptor
|
||||
<P>
|
||||
|
||||
The word following the redirection operator in the following
|
||||
descriptions, unless otherwise noted, is subjected to brace expansion,
|
||||
tilde expansion, parameter expansion, command substitution, arithmetic
|
||||
expansion, quote removal, pathname expansion, and word splitting.
|
||||
descriptions, unless otherwise noted, is subjected to
|
||||
brace expansion, tilde expansion, parameter and variable expansion,
|
||||
command substitution, arithmetic expansion, quote removal,
|
||||
pathname expansion, and word splitting.
|
||||
If it expands to more than one word,
|
||||
<B>bash</B>
|
||||
|
||||
@@ -4618,8 +4627,8 @@ The format of here-documents is:
|
||||
|
||||
<P>
|
||||
|
||||
No parameter expansion, command substitution, arithmetic expansion,
|
||||
or pathname expansion is performed on
|
||||
No parameter and variable expansion, command substitution,
|
||||
arithmetic expansion, or pathname expansion is performed on
|
||||
<I>word</I>.
|
||||
|
||||
If any characters in
|
||||
@@ -4676,10 +4685,12 @@ A variant of here documents, the format is:
|
||||
|
||||
<P>
|
||||
|
||||
The <I>word</I>
|
||||
is expanded as described above, with the exception that
|
||||
pathname expansion is not applied, and supplied as a single string
|
||||
to the command on its standard input.
|
||||
The <I>word</I> undergoes
|
||||
brace expansion, tilde expansion, parameter and variable expansion,
|
||||
command substitution, arithmetic expansion, and quote removal.
|
||||
Pathname expansion word splitting are not performed.
|
||||
The result is supplied as a single string to the command on its
|
||||
standard input.
|
||||
<A NAME="lbBQ"> </A>
|
||||
<H4>Duplicating File Descriptors</H4>
|
||||
|
||||
@@ -5648,7 +5659,7 @@ When
|
||||
invokes an external command, the variable
|
||||
<B>_</B>
|
||||
|
||||
is set to the full file name of the command and passed to that
|
||||
is set to the full filename of the command and passed to that
|
||||
command in its environment.
|
||||
<A NAME="lbCB"> </A>
|
||||
<H3>EXIT STATUS</H3>
|
||||
@@ -7695,12 +7706,12 @@ will be executed by the shell.
|
||||
<DD>
|
||||
The word before point is treated as a pattern for pathname expansion,
|
||||
with an asterisk implicitly appended. This pattern is used to
|
||||
generate a list of matching file names for possible completions.
|
||||
generate a list of matching filenames for possible completions.
|
||||
<DT><B>glob-expand-word (C-x *)</B>
|
||||
|
||||
<DD>
|
||||
The word before point is treated as a pattern for pathname expansion,
|
||||
and the list of matching file names is inserted, replacing the word.
|
||||
and the list of matching filenames is inserted, replacing the word.
|
||||
If a numeric argument is supplied, an asterisk is appended before
|
||||
pathname expansion.
|
||||
<DT><B>glob-list-expansions (C-x g)</B>
|
||||
@@ -8404,11 +8415,11 @@ one or more of the following modifiers, each preceded by a `:'.
|
||||
<DT><B>h</B>
|
||||
|
||||
<DD>
|
||||
Remove a trailing file name component, leaving only the head.
|
||||
Remove a trailing filename component, leaving only the head.
|
||||
<DT><B>t</B>
|
||||
|
||||
<DD>
|
||||
Remove all leading file name components, leaving the tail.
|
||||
Remove all leading filename components, leaving the tail.
|
||||
<DT><B>r</B>
|
||||
|
||||
<DD>
|
||||
@@ -8541,7 +8552,7 @@ executed from
|
||||
If
|
||||
<I>filename</I>
|
||||
|
||||
does not contain a slash, file names in
|
||||
does not contain a slash, filenames in
|
||||
<FONT SIZE=-1><B>PATH</B>
|
||||
|
||||
</FONT>
|
||||
@@ -8834,10 +8845,11 @@ status.
|
||||
An argument of
|
||||
<B>-</B>
|
||||
|
||||
is equivalent to
|
||||
<FONT SIZE=-1><B>$OLDPWD</B>.
|
||||
is converted to
|
||||
<FONT SIZE=-1><B>$OLDPWD</B>
|
||||
|
||||
</FONT>
|
||||
before the directory change is attempted.
|
||||
If a non-empty directory name from
|
||||
<FONT SIZE=-1><B>CDPATH</B>
|
||||
|
||||
@@ -8883,7 +8895,7 @@ option is supplied, a description of
|
||||
is printed. The
|
||||
<B>-v</B>
|
||||
|
||||
option causes a single word indicating the command or file name
|
||||
option causes a single word indicating the command or filename
|
||||
used to invoke
|
||||
<I>command</I>
|
||||
|
||||
@@ -9312,12 +9324,18 @@ turns off the attribute instead,
|
||||
with the exceptions that <B>+a</B>
|
||||
may not be used to destroy an array variable and <B>+r</B> will not
|
||||
remove the readonly attribute.
|
||||
When used in a function, makes each
|
||||
When used in a function,
|
||||
<B>declare</B>
|
||||
|
||||
and
|
||||
<B>typeset</B>
|
||||
|
||||
make each
|
||||
<I>name</I> local, as with the
|
||||
<B>local</B>
|
||||
|
||||
command,
|
||||
unless the <B>-g</B> option is supplied,
|
||||
unless the <B>-g</B> option is supplied.
|
||||
If a variable name is followed by =<I>value</I>, the value of
|
||||
the variable is set to <I>value</I>.
|
||||
The return value is 0 unless an invalid option is encountered,
|
||||
@@ -9335,7 +9353,7 @@ an attempt is made to turn off array status for an array variable,
|
||||
or an attempt is made to display a non-existent function with <B>-f</B>.
|
||||
</DL>
|
||||
|
||||
<DT><B>dirs [+</B><I>n</I>] [-<I>n</I>] [<B>-clpv</B>]
|
||||
<DT><B>dirs [-clpv</B>] [+<I>n</I>] [-<I>n</I>]
|
||||
|
||||
<DD>
|
||||
Without options, displays the list of currently remembered directories.
|
||||
@@ -9351,6 +9369,24 @@ command removes entries from the list.
|
||||
<DL COMPACT><DT><DD>
|
||||
|
||||
<DL COMPACT>
|
||||
<DT><B>-c</B>
|
||||
|
||||
<DD>
|
||||
Clears the directory stack by deleting all of the entries.
|
||||
<DT><B>-l</B>
|
||||
|
||||
<DD>
|
||||
Produces a listing using full pathnames;
|
||||
the default listing format uses a tilde to denote the home directory.
|
||||
<DT><B>-p</B>
|
||||
|
||||
<DD>
|
||||
Print the directory stack with one entry per line.
|
||||
<DT><B>-v</B>
|
||||
|
||||
<DD>
|
||||
Print the directory stack with one entry per line,
|
||||
prefixing each entry with its index in the stack.
|
||||
<DT><B>+</B><I>n</I><DD>
|
||||
Displays the <I>n</I>th entry counting from the left of the list
|
||||
shown by
|
||||
@@ -9363,24 +9399,6 @@ shown by
|
||||
<B>dirs</B>
|
||||
|
||||
when invoked without options, starting with zero.
|
||||
<DT><B>-c</B>
|
||||
|
||||
<DD>
|
||||
Clears the directory stack by deleting all of the entries.
|
||||
<DT><B>-l</B>
|
||||
|
||||
<DD>
|
||||
Produces a longer listing; the default listing format uses a
|
||||
tilde to denote the home directory.
|
||||
<DT><B>-p</B>
|
||||
|
||||
<DD>
|
||||
Print the directory stack with one entry per line.
|
||||
<DT><B>-v</B>
|
||||
|
||||
<DD>
|
||||
Print the directory stack with one entry per line,
|
||||
prefixing each entry with its index in the stack.
|
||||
|
||||
</DL>
|
||||
<P>
|
||||
@@ -9391,10 +9409,10 @@ of the directory stack.
|
||||
</DL>
|
||||
|
||||
<DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>jobspec</I> ...]<DD>
|
||||
Without options, each
|
||||
Without options, remove each
|
||||
<I>jobspec</I>
|
||||
|
||||
is removed from the table of active jobs.
|
||||
from the table of active jobs.
|
||||
If
|
||||
<I>jobspec</I>
|
||||
|
||||
@@ -9618,14 +9636,16 @@ to be executed with an empty environment. If
|
||||
is supplied, the shell passes
|
||||
<I>name</I>
|
||||
|
||||
as the zeroth argument to the executed command. If
|
||||
as the zeroth argument to the executed command.
|
||||
If
|
||||
<I>command</I>
|
||||
|
||||
cannot be executed for some reason, a non-interactive shell exits,
|
||||
unless the shell option
|
||||
unless the
|
||||
<B>execfail</B>
|
||||
|
||||
is enabled, in which case it returns failure.
|
||||
shell option
|
||||
is enabled. In that case, it returns failure.
|
||||
An interactive shell returns failure if the file cannot be executed.
|
||||
If
|
||||
<I>command</I>
|
||||
@@ -9670,7 +9690,7 @@ are given, or if the
|
||||
<B>-p</B>
|
||||
|
||||
option is supplied, a list
|
||||
of all names that are exported in this shell is printed.
|
||||
of names of all exported variables is printed.
|
||||
The
|
||||
<B>-n</B>
|
||||
|
||||
@@ -9693,13 +9713,13 @@ that is not a function.
|
||||
|
||||
<DT><B>fc</B> <B>-s</B> [<I>pat</I>=<I>rep</I>] [<I>cmd</I>]<DD>
|
||||
|
||||
Fix Command. In the first form, a range of commands from
|
||||
The first form selects a range of commands from
|
||||
<I>first</I>
|
||||
|
||||
to
|
||||
<I>last</I>
|
||||
|
||||
is selected from the history list.
|
||||
from the history list and displays or edits and re-executes them.
|
||||
<I>First</I>
|
||||
|
||||
and
|
||||
@@ -9768,6 +9788,7 @@ echoed and executed.
|
||||
<P>
|
||||
In the second form, <I>command</I> is re-executed after each instance
|
||||
of <I>pat</I> is replaced by <I>rep</I>.
|
||||
<I>Command</I> is intepreted the same as <I>first</I> above.
|
||||
A useful alias to use with this is
|
||||
|
||||
<TT>r='fc -s'</TT>,
|
||||
@@ -9895,7 +9916,7 @@ can report errors in two ways. If the first character of
|
||||
is a colon,
|
||||
<I>silent</I>
|
||||
|
||||
error reporting is used. In normal operation diagnostic messages
|
||||
error reporting is used. In normal operation, diagnostic messages
|
||||
are printed when invalid options or missing option arguments are
|
||||
encountered.
|
||||
If the variable
|
||||
@@ -9973,7 +9994,7 @@ If the
|
||||
option is supplied, no path search is performed, and
|
||||
<I>filename</I>
|
||||
|
||||
is used as the full file name of the command.
|
||||
is used as the full filename of the command.
|
||||
The
|
||||
<B>-r</B>
|
||||
|
||||
@@ -10095,11 +10116,11 @@ current <B>bash</B> session.
|
||||
|
||||
<DD>
|
||||
Read the contents of the history file
|
||||
and use them as the current history.
|
||||
and append them to the current history list.
|
||||
<DT><B>-w</B>
|
||||
|
||||
<DD>
|
||||
Write the current history to the history file, overwriting the
|
||||
Write the current history list to the history file, overwriting the
|
||||
history file's contents.
|
||||
<DT><B>-p</B>
|
||||
|
||||
@@ -10166,11 +10187,11 @@ leader.
|
||||
<DT><B>-r</B>
|
||||
|
||||
<DD>
|
||||
Restrict output to running jobs.
|
||||
Display only running jobs.
|
||||
<DT><B>-s</B>
|
||||
|
||||
<DD>
|
||||
Restrict output to stopped jobs.
|
||||
Display only stopped jobs.
|
||||
|
||||
</DL>
|
||||
<P>
|
||||
@@ -10558,7 +10579,8 @@ Adds
|
||||
<I>dir</I>
|
||||
|
||||
to the directory stack at the top, making it the
|
||||
new current working directory.
|
||||
new current working directory as if it had been supplied as the argument
|
||||
to the <B>cd</B> builtin.
|
||||
|
||||
</DL>
|
||||
<P>
|
||||
@@ -10712,8 +10734,9 @@ the decimal point.
|
||||
This option is only effective if <B>read</B> is reading input from a
|
||||
terminal, pipe, or other special file; it has no effect when reading
|
||||
from regular files.
|
||||
If <I>timeout</I> is 0, <B>read</B> returns success if input is available on
|
||||
the specified file descriptor, failure otherwise.
|
||||
If <I>timeout</I> is 0, <B>read</B> returns immediately, without trying to
|
||||
read any data. The exit statis is 0 if input is available on
|
||||
the specified file descriptor, non-zero otherwise.
|
||||
The exit status is greater than 128 if the timeout is exceeded.
|
||||
<DT><B>-u </B><I>fd</I>
|
||||
|
||||
@@ -10787,14 +10810,18 @@ is supplied with a
|
||||
|
||||
that is not a function.
|
||||
<DT><B>return</B> [<I>n</I>]<DD>
|
||||
Causes a function to exit with the return value specified by
|
||||
<I>n</I>.
|
||||
Causes a function to stop executing and return the value specified by
|
||||
<I>n</I>
|
||||
|
||||
to its caller.
|
||||
If
|
||||
<I>n</I>
|
||||
|
||||
is omitted, the return status is that of the last command
|
||||
executed in the function body. If used outside a function,
|
||||
executed in the function body. If
|
||||
<B>return</B>
|
||||
|
||||
is used outside a function,
|
||||
but during execution of a script by the
|
||||
<B>.</B>
|
||||
|
||||
@@ -10803,9 +10830,12 @@ that script and return either
|
||||
<I>n</I>
|
||||
|
||||
or the exit status of the last command executed within the
|
||||
script as the exit status of the script. If used outside a
|
||||
function and not during execution of a script by <B>.</B>,
|
||||
the return status is false.
|
||||
script as the exit status of the script.
|
||||
The return status is non-zero if
|
||||
<B>return</B>
|
||||
|
||||
is used outside a
|
||||
function and not during execution of a script by <B>.</B> or <B>source</B>.
|
||||
Any command associated with the <B>RETURN</B> trap is executed
|
||||
before execution resumes after the function or script.
|
||||
<DT><B>set</B> [<B>--abefhkmnptuvxBCEHPT</B>] [<B>-o</B> <I>option-name</I>] [<I>arg</I> ...]<DD>
|
||||
@@ -10847,14 +10877,15 @@ effective only when job control is enabled.
|
||||
<DT><B>-e</B>
|
||||
|
||||
<DD>
|
||||
Exit immediately if a <I>pipeline</I> (which may consist of a single
|
||||
<I>simple command</I>), a <I>subshell</I> command enclosed in parentheses,
|
||||
or one of the commands executed as part of a command list enclosed
|
||||
by braces (see
|
||||
Exit immediately if a
|
||||
<I>pipeline</I> (which may consist of a single <I>simple command</I>),
|
||||
a <I>list</I>,
|
||||
or a <I>compound command</I>
|
||||
(see
|
||||
<FONT SIZE=-1><B>SHELL GRAMMAR</B>
|
||||
|
||||
</FONT>
|
||||
above) exits with a non-zero status.
|
||||
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
|
||||
<B>while</B>
|
||||
@@ -10881,6 +10912,9 @@ or if the command's return value is
|
||||
being inverted with
|
||||
<B>!</B>.
|
||||
|
||||
If a compound command other than a subshell
|
||||
returns a non-zero status because a command failed
|
||||
while <B>-e</B> was being ignored, the shell does not exit.
|
||||
A trap on <B>ERR</B>, if set, is executed before the shell exits.
|
||||
This option applies to the shell environment and each subshell environment
|
||||
separately (see
|
||||
@@ -11358,8 +11392,10 @@ If either
|
||||
or
|
||||
<B>-u</B>
|
||||
|
||||
is used with no <I>optname</I> arguments, the display is limited to
|
||||
those options which are set or unset, respectively.
|
||||
is used with no <I>optname</I> arguments,
|
||||
<B>shopt</B>
|
||||
|
||||
shows only those options which are set or unset, respectively.
|
||||
Unless otherwise noted, the <B>shopt</B> options are disabled (unset)
|
||||
by default.
|
||||
<P>
|
||||
@@ -11400,7 +11436,7 @@ If set, minor errors in the spelling of a directory component in a
|
||||
command will be corrected.
|
||||
The errors checked for are transposed characters,
|
||||
a missing character, and one character too many.
|
||||
If a correction is found, the corrected file name is printed,
|
||||
If a correction is found, the corrected filename is printed,
|
||||
and the command proceeds.
|
||||
This option is only used by interactive shells.
|
||||
<DT><B>checkhash</B>
|
||||
@@ -11487,6 +11523,28 @@ parameter expansion as a special character. The single quotes must match
|
||||
(an even number) and the characters between the single quotes are considered
|
||||
quoted. This is the behavior of posix mode through version 4.1.
|
||||
The default bash behavior remains as in previous versions.
|
||||
<DT><B>complete_fullquote</B>
|
||||
|
||||
<DD>
|
||||
If set,
|
||||
<B>bash</B>
|
||||
|
||||
quotes all shell metacharacters in filenames and directory names when
|
||||
performing completion.
|
||||
If not set,
|
||||
<B>bash</B>
|
||||
|
||||
removes metacharacters such as the dollar sign from the set of
|
||||
characters that will be quoted in completed filenames
|
||||
when these metacharacters appear in shell variable references in 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 backslashes to quote completed
|
||||
filenames.
|
||||
This variable is set by default, which is the default bash behavior in
|
||||
versions through 4.2.
|
||||
<DT><B>direxpand</B>
|
||||
|
||||
<DD>
|
||||
@@ -11853,7 +11911,7 @@ is not supplied, or if job control is not enabled.
|
||||
<DT><B>test</B> <I>expr</I><DD>
|
||||
|
||||
<DT><B>[</B> <I>expr</I> <B>]</B><DD>
|
||||
Return a status of 0 or 1 depending on
|
||||
Return a status of 0 (true) or 1 (false) depending on
|
||||
the evaluation of the conditional expression
|
||||
<I>expr</I>.
|
||||
|
||||
@@ -12194,7 +12252,7 @@ If a command is hashed,
|
||||
and
|
||||
<B>-P</B>
|
||||
|
||||
print the hashed value, not necessarily the file that appears
|
||||
print the hashed value, which is not necessarily the file that appears
|
||||
first in
|
||||
<FONT SIZE=-1><B>PATH</B>.
|
||||
|
||||
@@ -12344,20 +12402,21 @@ The maximum number of threads
|
||||
If
|
||||
<I>limit</I>
|
||||
|
||||
is given, it is the new value of the specified resource (the
|
||||
is given, and the
|
||||
<B>-a</B>
|
||||
|
||||
option is display only).
|
||||
option is not used,
|
||||
<I>limit</I> is the new value of the specified resource.
|
||||
If no option is given, then
|
||||
<B>-f</B>
|
||||
|
||||
is assumed. Values are in 1024-byte increments, except for
|
||||
<B>-t</B>,
|
||||
|
||||
which is in seconds,
|
||||
which is in seconds;
|
||||
<B>-p</B>,
|
||||
|
||||
which is in units of 512-byte blocks,
|
||||
which is in units of 512-byte blocks;
|
||||
and
|
||||
<B>-T</B>,
|
||||
|
||||
@@ -12537,7 +12596,7 @@ specifying command names containing
|
||||
<B>/</B>
|
||||
|
||||
<DT>*<DD>
|
||||
specifying a file name containing a
|
||||
specifying a filename containing a
|
||||
<B>/</B>
|
||||
|
||||
as an argument to the
|
||||
@@ -12773,7 +12832,7 @@ There may be only one active coprocess at a time.
|
||||
<HR>
|
||||
<TABLE WIDTH=100%>
|
||||
<TR>
|
||||
<TH ALIGN=LEFT width=33%>GNU Bash 4.2<TH ALIGN=CENTER width=33%>2011 July 7<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
<TH ALIGN=LEFT width=33%>GNU Bash 4.2<TH ALIGN=CENTER width=33%>2011 September 25<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
</TR>
|
||||
</TABLE>
|
||||
<HR>
|
||||
@@ -12879,6 +12938,6 @@ There may be only one active coprocess at a time.
|
||||
</DL>
|
||||
<HR>
|
||||
This document was created by man2html from bash.1.<BR>
|
||||
Time: 08 July 2011 17:23:53 EDT
|
||||
Time: 26 September 2011 10:56:19 EDT
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
Binary file not shown.
+4597
-4551
File diff suppressed because it is too large
Load Diff
+16
-16
@@ -78,9 +78,9 @@
|
||||
@xrdef{Positional Parameters-title}{Positional Parameters}
|
||||
@xrdef{Positional Parameters-snt}{Section@tie 3.4.1}
|
||||
@xrdef{Shell Parameters-pg}{17}
|
||||
@xrdef{Positional Parameters-pg}{17}
|
||||
@xrdef{Special Parameters-title}{Special Parameters}
|
||||
@xrdef{Special Parameters-snt}{Section@tie 3.4.2}
|
||||
@xrdef{Positional Parameters-pg}{18}
|
||||
@xrdef{Special Parameters-pg}{18}
|
||||
@xrdef{Shell Expansions-title}{Shell Expansions}
|
||||
@xrdef{Shell Expansions-snt}{Section@tie 3.5}
|
||||
@@ -98,15 +98,15 @@
|
||||
@xrdef{Command Substitution-snt}{Section@tie 3.5.4}
|
||||
@xrdef{Arithmetic Expansion-title}{Arithmetic Expansion}
|
||||
@xrdef{Arithmetic Expansion-snt}{Section@tie 3.5.5}
|
||||
@xrdef{Process Substitution-title}{Process Substitution}
|
||||
@xrdef{Process Substitution-snt}{Section@tie 3.5.6}
|
||||
@xrdef{Command Substitution-pg}{24}
|
||||
@xrdef{Arithmetic Expansion-pg}{24}
|
||||
@xrdef{Process Substitution-pg}{24}
|
||||
@xrdef{Process Substitution-title}{Process Substitution}
|
||||
@xrdef{Process Substitution-snt}{Section@tie 3.5.6}
|
||||
@xrdef{Word Splitting-title}{Word Splitting}
|
||||
@xrdef{Word Splitting-snt}{Section@tie 3.5.7}
|
||||
@xrdef{Filename Expansion-title}{Filename Expansion}
|
||||
@xrdef{Filename Expansion-snt}{Section@tie 3.5.8}
|
||||
@xrdef{Process Substitution-pg}{25}
|
||||
@xrdef{Word Splitting-pg}{25}
|
||||
@xrdef{Filename Expansion-pg}{25}
|
||||
@xrdef{Pattern Matching-title}{Pattern Matching}
|
||||
@@ -126,21 +126,21 @@
|
||||
@xrdef{Command Search and Execution-snt}{Section@tie 3.7.2}
|
||||
@xrdef{Executing Commands-pg}{31}
|
||||
@xrdef{Simple Command Expansion-pg}{31}
|
||||
@xrdef{Command Search and Execution-pg}{31}
|
||||
@xrdef{Command Execution Environment-title}{Command Execution Environment}
|
||||
@xrdef{Command Execution Environment-snt}{Section@tie 3.7.3}
|
||||
@xrdef{Command Search and Execution-pg}{32}
|
||||
@xrdef{Command Execution Environment-pg}{32}
|
||||
@xrdef{Environment-title}{Environment}
|
||||
@xrdef{Environment-snt}{Section@tie 3.7.4}
|
||||
@xrdef{Environment-pg}{33}
|
||||
@xrdef{Exit Status-title}{Exit Status}
|
||||
@xrdef{Exit Status-snt}{Section@tie 3.7.5}
|
||||
@xrdef{Environment-pg}{33}
|
||||
@xrdef{Exit Status-pg}{33}
|
||||
@xrdef{Signals-title}{Signals}
|
||||
@xrdef{Signals-snt}{Section@tie 3.7.6}
|
||||
@xrdef{Exit Status-pg}{34}
|
||||
@xrdef{Signals-pg}{34}
|
||||
@xrdef{Shell Scripts-title}{Shell Scripts}
|
||||
@xrdef{Shell Scripts-snt}{Section@tie 3.8}
|
||||
@xrdef{Signals-pg}{34}
|
||||
@xrdef{Shell Scripts-pg}{35}
|
||||
@xrdef{Shell Builtin Commands-title}{Shell Builtin Commands}
|
||||
@xrdef{Shell Builtin Commands-snt}{Chapter@tie 4}
|
||||
@@ -150,19 +150,19 @@
|
||||
@xrdef{Bourne Shell Builtins-pg}{37}
|
||||
@xrdef{Bash Builtins-title}{Bash Builtin Commands}
|
||||
@xrdef{Bash Builtins-snt}{Section@tie 4.2}
|
||||
@xrdef{Bash Builtins-pg}{43}
|
||||
@xrdef{Bash Builtins-pg}{44}
|
||||
@xrdef{Modifying Shell Behavior-title}{Modifying Shell Behavior}
|
||||
@xrdef{Modifying Shell Behavior-snt}{Section@tie 4.3}
|
||||
@xrdef{The Set Builtin-title}{The Set Builtin}
|
||||
@xrdef{The Set Builtin-snt}{Section@tie 4.3.1}
|
||||
@xrdef{Modifying Shell Behavior-pg}{53}
|
||||
@xrdef{Modifying Shell Behavior-pg}{54}
|
||||
@xrdef{The Set Builtin-pg}{54}
|
||||
@xrdef{The Shopt Builtin-title}{The Shopt Builtin}
|
||||
@xrdef{The Shopt Builtin-snt}{Section@tie 4.3.2}
|
||||
@xrdef{The Shopt Builtin-pg}{57}
|
||||
@xrdef{The Shopt Builtin-pg}{58}
|
||||
@xrdef{Special Builtins-title}{Special Builtins}
|
||||
@xrdef{Special Builtins-snt}{Section@tie 4.4}
|
||||
@xrdef{Special Builtins-pg}{62}
|
||||
@xrdef{Special Builtins-pg}{63}
|
||||
@xrdef{Shell Variables-title}{Shell Variables}
|
||||
@xrdef{Shell Variables-snt}{Chapter@tie 5}
|
||||
@xrdef{Bourne Shell Variables-title}{Bourne Shell Variables}
|
||||
@@ -211,9 +211,9 @@
|
||||
@xrdef{Directory Stack Builtins-snt}{Section@tie 6.8.1}
|
||||
@xrdef{The Directory Stack-pg}{85}
|
||||
@xrdef{Directory Stack Builtins-pg}{85}
|
||||
@xrdef{Printing a Prompt-title}{Controlling the Prompt}
|
||||
@xrdef{Printing a Prompt-snt}{Section@tie 6.9}
|
||||
@xrdef{Printing a Prompt-pg}{86}
|
||||
@xrdef{Controlling the Prompt-title}{Controlling the Prompt}
|
||||
@xrdef{Controlling the Prompt-snt}{Section@tie 6.9}
|
||||
@xrdef{Controlling the Prompt-pg}{87}
|
||||
@xrdef{The Restricted Shell-title}{The Restricted Shell}
|
||||
@xrdef{The Restricted Shell-snt}{Section@tie 6.10}
|
||||
@xrdef{Bash POSIX Mode-title}{Bash POSIX Mode}
|
||||
@@ -318,9 +318,9 @@
|
||||
@xrdef{Event Designators-title}{Event Designators}
|
||||
@xrdef{Event Designators-snt}{Section@tie 9.3.1}
|
||||
@xrdef{History Interaction-pg}{129}
|
||||
@xrdef{Event Designators-pg}{129}
|
||||
@xrdef{Word Designators-title}{Word Designators}
|
||||
@xrdef{Word Designators-snt}{Section@tie 9.3.2}
|
||||
@xrdef{Event Designators-pg}{130}
|
||||
@xrdef{Word Designators-pg}{130}
|
||||
@xrdef{Modifiers-title}{Modifiers}
|
||||
@xrdef{Modifiers-snt}{Section@tie 9.3.3}
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@
|
||||
\entry{continue}{38}{\code {continue}}
|
||||
\entry{eval}{38}{\code {eval}}
|
||||
\entry{exec}{38}{\code {exec}}
|
||||
\entry{exit}{38}{\code {exit}}
|
||||
\entry{exit}{39}{\code {exit}}
|
||||
\entry{export}{39}{\code {export}}
|
||||
\entry{getopts}{39}{\code {getopts}}
|
||||
\entry{hash}{40}{\code {hash}}
|
||||
@@ -19,7 +19,7 @@
|
||||
\entry{trap}{42}{\code {trap}}
|
||||
\entry{umask}{43}{\code {umask}}
|
||||
\entry{unset}{43}{\code {unset}}
|
||||
\entry{alias}{43}{\code {alias}}
|
||||
\entry{alias}{44}{\code {alias}}
|
||||
\entry{bind}{44}{\code {bind}}
|
||||
\entry{builtin}{45}{\code {builtin}}
|
||||
\entry{caller}{45}{\code {caller}}
|
||||
@@ -29,19 +29,19 @@
|
||||
\entry{enable}{48}{\code {enable}}
|
||||
\entry{help}{48}{\code {help}}
|
||||
\entry{let}{48}{\code {let}}
|
||||
\entry{local}{48}{\code {local}}
|
||||
\entry{local}{49}{\code {local}}
|
||||
\entry{logout}{49}{\code {logout}}
|
||||
\entry{mapfile}{49}{\code {mapfile}}
|
||||
\entry{printf}{49}{\code {printf}}
|
||||
\entry{read}{50}{\code {read}}
|
||||
\entry{readarray}{51}{\code {readarray}}
|
||||
\entry{source}{51}{\code {source}}
|
||||
\entry{source}{52}{\code {source}}
|
||||
\entry{type}{52}{\code {type}}
|
||||
\entry{typeset}{52}{\code {typeset}}
|
||||
\entry{ulimit}{52}{\code {ulimit}}
|
||||
\entry{unalias}{53}{\code {unalias}}
|
||||
\entry{set}{54}{\code {set}}
|
||||
\entry{shopt}{57}{\code {shopt}}
|
||||
\entry{shopt}{58}{\code {shopt}}
|
||||
\entry{dirs}{85}{\code {dirs}}
|
||||
\entry{popd}{86}{\code {popd}}
|
||||
\entry{pushd}{86}{\code {pushd}}
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@
|
||||
\initial {[}
|
||||
\entry {\code {[}}{41}
|
||||
\initial {A}
|
||||
\entry {\code {alias}}{43}
|
||||
\entry {\code {alias}}{44}
|
||||
\initial {B}
|
||||
\entry {\code {bg}}{94}
|
||||
\entry {\code {bind}}{44}
|
||||
@@ -28,7 +28,7 @@
|
||||
\entry {\code {enable}}{48}
|
||||
\entry {\code {eval}}{38}
|
||||
\entry {\code {exec}}{38}
|
||||
\entry {\code {exit}}{38}
|
||||
\entry {\code {exit}}{39}
|
||||
\entry {\code {export}}{39}
|
||||
\initial {F}
|
||||
\entry {\code {fc}}{127}
|
||||
@@ -45,7 +45,7 @@
|
||||
\entry {\code {kill}}{95}
|
||||
\initial {L}
|
||||
\entry {\code {let}}{48}
|
||||
\entry {\code {local}}{48}
|
||||
\entry {\code {local}}{49}
|
||||
\entry {\code {logout}}{49}
|
||||
\initial {M}
|
||||
\entry {\code {mapfile}}{49}
|
||||
@@ -62,8 +62,8 @@
|
||||
\initial {S}
|
||||
\entry {\code {set}}{54}
|
||||
\entry {\code {shift}}{41}
|
||||
\entry {\code {shopt}}{57}
|
||||
\entry {\code {source}}{51}
|
||||
\entry {\code {shopt}}{58}
|
||||
\entry {\code {source}}{52}
|
||||
\entry {\code {suspend}}{95}
|
||||
\initial {T}
|
||||
\entry {\code {test}}{41}
|
||||
|
||||
+9
-9
@@ -42,7 +42,7 @@
|
||||
\entry{parameters}{17}{parameters}
|
||||
\entry{variable, shell}{17}{variable, shell}
|
||||
\entry{shell variable}{17}{shell variable}
|
||||
\entry{parameters, positional}{17}{parameters, positional}
|
||||
\entry{parameters, positional}{18}{parameters, positional}
|
||||
\entry{parameters, special}{18}{parameters, special}
|
||||
\entry{expansion}{19}{expansion}
|
||||
\entry{brace expansion}{19}{brace expansion}
|
||||
@@ -54,7 +54,7 @@
|
||||
\entry{command substitution}{24}{command substitution}
|
||||
\entry{expansion, arithmetic}{24}{expansion, arithmetic}
|
||||
\entry{arithmetic expansion}{24}{arithmetic expansion}
|
||||
\entry{process substitution}{24}{process substitution}
|
||||
\entry{process substitution}{25}{process substitution}
|
||||
\entry{word splitting}{25}{word splitting}
|
||||
\entry{expansion, filename}{25}{expansion, filename}
|
||||
\entry{expansion, pathname}{25}{expansion, pathname}
|
||||
@@ -64,14 +64,14 @@
|
||||
\entry{matching, pattern}{26}{matching, pattern}
|
||||
\entry{redirection}{27}{redirection}
|
||||
\entry{command expansion}{31}{command expansion}
|
||||
\entry{command execution}{31}{command execution}
|
||||
\entry{command search}{31}{command search}
|
||||
\entry{command execution}{32}{command execution}
|
||||
\entry{command search}{32}{command search}
|
||||
\entry{execution environment}{32}{execution environment}
|
||||
\entry{environment}{33}{environment}
|
||||
\entry{exit status}{33}{exit status}
|
||||
\entry{exit status}{34}{exit status}
|
||||
\entry{signal handling}{34}{signal handling}
|
||||
\entry{shell script}{35}{shell script}
|
||||
\entry{special builtin}{62}{special builtin}
|
||||
\entry{special builtin}{63}{special builtin}
|
||||
\entry{login shell}{77}{login shell}
|
||||
\entry{interactive shell}{77}{interactive shell}
|
||||
\entry{startup files}{77}{startup files}
|
||||
@@ -86,7 +86,7 @@
|
||||
\entry{alias expansion}{83}{alias expansion}
|
||||
\entry{arrays}{84}{arrays}
|
||||
\entry{directory stack}{85}{directory stack}
|
||||
\entry{prompting}{86}{prompting}
|
||||
\entry{prompting}{87}{prompting}
|
||||
\entry{restricted shell}{88}{restricted shell}
|
||||
\entry{POSIX Mode}{88}{POSIX Mode}
|
||||
\entry{job control}{93}{job control}
|
||||
@@ -110,8 +110,8 @@
|
||||
\entry{history list}{127}{history list}
|
||||
\entry{history builtins}{127}{history builtins}
|
||||
\entry{history expansion}{129}{history expansion}
|
||||
\entry{event designators}{129}{event designators}
|
||||
\entry{history events}{129}{history events}
|
||||
\entry{event designators}{130}{event designators}
|
||||
\entry{history events}{130}{history events}
|
||||
\entry{installation}{133}{installation}
|
||||
\entry{configuration}{133}{configuration}
|
||||
\entry{Bash installation}{133}{Bash installation}
|
||||
|
||||
+9
-9
@@ -13,10 +13,10 @@
|
||||
\entry {builtin}{3}
|
||||
\initial {C}
|
||||
\entry {command editing}{98}
|
||||
\entry {command execution}{31}
|
||||
\entry {command execution}{32}
|
||||
\entry {command expansion}{31}
|
||||
\entry {command history}{127}
|
||||
\entry {command search}{31}
|
||||
\entry {command search}{32}
|
||||
\entry {command substitution}{24}
|
||||
\entry {command timing}{8}
|
||||
\entry {commands, compound}{9}
|
||||
@@ -38,9 +38,9 @@
|
||||
\entry {editing command lines}{98}
|
||||
\entry {environment}{33}
|
||||
\entry {evaluation, arithmetic}{82}
|
||||
\entry {event designators}{129}
|
||||
\entry {event designators}{130}
|
||||
\entry {execution environment}{32}
|
||||
\entry {exit status}{3, 33}
|
||||
\entry {exit status}{3, 34}
|
||||
\entry {expansion}{19}
|
||||
\entry {expansion, arithmetic}{24}
|
||||
\entry {expansion, brace}{19}
|
||||
@@ -58,7 +58,7 @@
|
||||
\entry {functions, shell}{15}
|
||||
\initial {H}
|
||||
\entry {history builtins}{127}
|
||||
\entry {history events}{129}
|
||||
\entry {history events}{130}
|
||||
\entry {history expansion}{129}
|
||||
\entry {history list}{127}
|
||||
\entry {History, how to use}{125}
|
||||
@@ -90,7 +90,7 @@
|
||||
\initial {P}
|
||||
\entry {parameter expansion}{21}
|
||||
\entry {parameters}{17}
|
||||
\entry {parameters, positional}{17}
|
||||
\entry {parameters, positional}{18}
|
||||
\entry {parameters, special}{18}
|
||||
\entry {pathname expansion}{25}
|
||||
\entry {pattern matching}{26}
|
||||
@@ -99,9 +99,9 @@
|
||||
\entry {POSIX Mode}{88}
|
||||
\entry {process group}{3}
|
||||
\entry {process group ID}{3}
|
||||
\entry {process substitution}{24}
|
||||
\entry {process substitution}{25}
|
||||
\entry {programmable completion}{119}
|
||||
\entry {prompting}{86}
|
||||
\entry {prompting}{87}
|
||||
\initial {Q}
|
||||
\entry {quoting}{6}
|
||||
\entry {quoting, ANSI}{6}
|
||||
@@ -119,7 +119,7 @@
|
||||
\entry {shell, interactive}{78}
|
||||
\entry {signal}{4}
|
||||
\entry {signal handling}{34}
|
||||
\entry {special builtin}{4, 62}
|
||||
\entry {special builtin}{4, 63}
|
||||
\entry {startup files}{77}
|
||||
\entry {suspending jobs}{93}
|
||||
\initial {T}
|
||||
|
||||
Binary file not shown.
+400
-255
File diff suppressed because it is too large
Load Diff
+630
-547
File diff suppressed because it is too large
Load Diff
+21
-34
@@ -1,4 +1,4 @@
|
||||
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2008.12.11) 8 JUL 2011 17:23
|
||||
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2008.12.11) 26 SEP 2011 10:56
|
||||
**/Users/chet/src/bash/src/doc/bashref.texi
|
||||
(/Users/chet/src/bash/src/doc/bashref.texi (./texinfo.tex
|
||||
Loading texinfo [version 2009-01-18.17]:
|
||||
@@ -178,9 +178,9 @@ and turning on texinfo input format.) (./bashref.aux)
|
||||
|
||||
Chapter 2
|
||||
[1] [2] [3] Chapter 3 [4] [5] [6] [7] [8] [9] [10]
|
||||
Overfull \hbox (43.33539pt too wide) in paragraph at lines 876--876
|
||||
Overfull \hbox (43.33539pt too wide) in paragraph at lines 882--882
|
||||
[]@texttt case @textttsl word @texttt in [ [(] @textttsl pat-tern @texttt [| @
|
||||
textttsl pat-tern@texttt ][]) @textttsl command-list @texttt ;;][] esac[][]
|
||||
textttsl pat-tern@texttt ][]) @textttsl command-list @texttt ;;][] esac[]
|
||||
|
||||
@hbox(7.60416+2.43333)x433.62
|
||||
.@glue(@leftskip) 86.72375
|
||||
@@ -191,7 +191,7 @@ textttsl pat-tern@texttt ][]) @textttsl command-list @texttt ;;][] esac[][]
|
||||
.etc.
|
||||
|
||||
[11] [12] [13] [14]
|
||||
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1198--1198
|
||||
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1204--1204
|
||||
[]@texttt cat list | parallel "do-something1 {} config-{} ; do-something2 < {}
|
||||
" | process-output[]
|
||||
|
||||
@@ -204,7 +204,7 @@ Overfull \hbox (89.6747pt too wide) in paragraph at lines 1198--1198
|
||||
.etc.
|
||||
|
||||
|
||||
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1213--1213
|
||||
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1219--1219
|
||||
[]@texttt { echo foss.org.my ; echo debian.org; echo freenetproject.org; } | p
|
||||
arallel traceroute[]
|
||||
|
||||
@@ -217,7 +217,7 @@ arallel traceroute[]
|
||||
.etc.
|
||||
|
||||
|
||||
Overfull \hbox (106.92076pt too wide) in paragraph at lines 1219--1219
|
||||
Overfull \hbox (106.92076pt too wide) in paragraph at lines 1225--1225
|
||||
[]@texttt { echo foss.org.my ; echo debian.org; echo freenetproject.org; } | p
|
||||
arallel -k traceroute[]
|
||||
|
||||
@@ -232,7 +232,7 @@ arallel -k traceroute[]
|
||||
[15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29]
|
||||
[30] [31] [32] [33] [34] Chapter 4 [35] [36] [37] [38] [39] [40] [41] [42]
|
||||
[43]
|
||||
Underfull \hbox (badness 5231) in paragraph at lines 3430--3443
|
||||
Underfull \hbox (badness 5231) in paragraph at lines 3479--3492
|
||||
@texttt emacs-meta[]@textrm , @texttt emacs-ctlx[]@textrm , @texttt vi[]@textr
|
||||
m , @texttt vi-move[]@textrm , @texttt vi-command[]@textrm , and
|
||||
|
||||
@@ -244,22 +244,9 @@ m , @texttt vi-move[]@textrm , @texttt vi-command[]@textrm , and
|
||||
.@texttt c
|
||||
.etc.
|
||||
|
||||
[44] [45] [46] [47] [48] [49]
|
||||
Overfull \hbox (172.34125pt too wide) in paragraph at lines 3888--3888
|
||||
[]@texttt read [-ers] [-a @textttsl aname@texttt ] [-d @textttsl de-lim@texttt
|
||||
] [-i @textttsl text@texttt ] [-n @textttsl nchars@texttt ] [-N @textttsl ncha
|
||||
rs@texttt ] [-p @textttsl prompt@texttt ] [-t @textttsl time-
|
||||
|
||||
@hbox(7.60416+2.43333)x433.62
|
||||
.@glue(@leftskip) 86.72375
|
||||
.@hbox(0.0+0.0)x0.0
|
||||
.@texttt r
|
||||
.@texttt e
|
||||
.@texttt a
|
||||
.etc.
|
||||
|
||||
[50] [51] [52] [53] [54] [55] [56] [57] [58] [59]
|
||||
Underfull \hbox (badness 5460) in paragraph at lines 4636--4642
|
||||
[44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57] [58]
|
||||
[59] [60]
|
||||
Underfull \hbox (badness 5460) in paragraph at lines 4725--4731
|
||||
[]@textrm If set, range ex-pres-sions used in pat-tern match-ing (see
|
||||
|
||||
@hbox(8.2125+2.73749)x433.62, glue set 3.79674
|
||||
@@ -270,9 +257,9 @@ Underfull \hbox (badness 5460) in paragraph at lines 4636--4642
|
||||
.@glue 3.65 plus 1.825 minus 1.21666
|
||||
.etc.
|
||||
|
||||
[60] [61] [62] Chapter 5 [63] [64] [65] [66] [67] [68] [69] [70] [71] [72]
|
||||
[73] Chapter 6 [74]
|
||||
Overfull \hbox (51.96864pt too wide) in paragraph at lines 5530--5530
|
||||
[61] [62] Chapter 5 [63] [64] [65] [66] [67] [68] [69] [70] [71] [72] [73]
|
||||
Chapter 6 [74]
|
||||
Overfull \hbox (51.96864pt too wide) in paragraph at lines 5617--5617
|
||||
[]@texttt bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@t
|
||||
exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
|
||||
|
||||
@@ -285,7 +272,7 @@ exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
|
||||
.etc.
|
||||
|
||||
|
||||
Overfull \hbox (76.23077pt too wide) in paragraph at lines 5531--5531
|
||||
Overfull \hbox (76.23077pt too wide) in paragraph at lines 5618--5618
|
||||
[]@texttt bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@texttt
|
||||
] [-O @textttsl shopt_option@texttt ] -c @textttsl string @texttt [@textttsl ar
|
||||
-
|
||||
@@ -299,7 +286,7 @@ Overfull \hbox (76.23077pt too wide) in paragraph at lines 5531--5531
|
||||
.etc.
|
||||
|
||||
|
||||
Overfull \hbox (34.72258pt too wide) in paragraph at lines 5532--5532
|
||||
Overfull \hbox (34.72258pt too wide) in paragraph at lines 5619--5619
|
||||
[]@texttt bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@text
|
||||
tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
|
||||
|
||||
@@ -312,7 +299,7 @@ tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
|
||||
.etc.
|
||||
|
||||
[75] [76]
|
||||
Underfull \hbox (badness 2245) in paragraph at lines 5705--5707
|
||||
Underfull \hbox (badness 2245) in paragraph at lines 5790--5792
|
||||
[]@textrm When a lo-gin shell ex-its, Bash reads and ex-e-cutes com-mands from
|
||||
the file
|
||||
|
||||
@@ -325,7 +312,7 @@ the file
|
||||
.etc.
|
||||
|
||||
[77] [78] [79] [80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90]
|
||||
Underfull \hbox (badness 2521) in paragraph at lines 6882--6885
|
||||
Underfull \hbox (badness 2521) in paragraph at lines 6980--6983
|
||||
@textrm `@texttt --enable-strict-posix-default[]@textrm '[] to @texttt configur
|
||||
e[] @textrm when build-ing (see Sec-tion 10.8
|
||||
|
||||
@@ -394,7 +381,7 @@ Underfull \hbox (badness 2753) in paragraph at lines 1946--1949
|
||||
[123] [124]) (/Users/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9
|
||||
[125] [126] [127] [128] [129] [130]) Chapter 10 [131] [132] [133] [134]
|
||||
[135]
|
||||
Underfull \hbox (badness 2772) in paragraph at lines 7483--7487
|
||||
Underfull \hbox (badness 2772) in paragraph at lines 7586--7590
|
||||
[]@textrm Enable sup-port for large files (@texttt http://www.sas.com/standard
|
||||
s/large_
|
||||
|
||||
@@ -413,11 +400,11 @@ s/large_
|
||||
[163] [164] )
|
||||
Here is how much of TeX's memory you used:
|
||||
2081 strings out of 97980
|
||||
28558 string characters out of 1221004
|
||||
65614 words of memory out of 1500000
|
||||
28573 string characters out of 1221004
|
||||
65630 words of memory out of 1500000
|
||||
2897 multiletter control sequences out of 10000+50000
|
||||
32127 words of font info for 112 fonts, out of 1200000 for 2000
|
||||
51 hyphenation exceptions out of 8191
|
||||
16i,6n,14p,315b,702s stack positions out of 5000i,500n,6000p,200000b,5000s
|
||||
|
||||
Output written on bashref.dvi (170 pages, 683940 bytes).
|
||||
Output written on bashref.dvi (170 pages, 687040 bytes).
|
||||
|
||||
Binary file not shown.
+3677
-3612
File diff suppressed because it is too large
Load Diff
+13
-13
@@ -24,7 +24,7 @@
|
||||
@numsubsecentry{GNU Parallel}{3.2.6}{GNU Parallel}{14}
|
||||
@numsecentry{Shell Functions}{3.3}{Shell Functions}{15}
|
||||
@numsecentry{Shell Parameters}{3.4}{Shell Parameters}{17}
|
||||
@numsubsecentry{Positional Parameters}{3.4.1}{Positional Parameters}{17}
|
||||
@numsubsecentry{Positional Parameters}{3.4.1}{Positional Parameters}{18}
|
||||
@numsubsecentry{Special Parameters}{3.4.2}{Special Parameters}{18}
|
||||
@numsecentry{Shell Expansions}{3.5}{Shell Expansions}{19}
|
||||
@numsubsecentry{Brace Expansion}{3.5.1}{Brace Expansion}{19}
|
||||
@@ -32,37 +32,37 @@
|
||||
@numsubsecentry{Shell Parameter Expansion}{3.5.3}{Shell Parameter Expansion}{21}
|
||||
@numsubsecentry{Command Substitution}{3.5.4}{Command Substitution}{24}
|
||||
@numsubsecentry{Arithmetic Expansion}{3.5.5}{Arithmetic Expansion}{24}
|
||||
@numsubsecentry{Process Substitution}{3.5.6}{Process Substitution}{24}
|
||||
@numsubsecentry{Process Substitution}{3.5.6}{Process Substitution}{25}
|
||||
@numsubsecentry{Word Splitting}{3.5.7}{Word Splitting}{25}
|
||||
@numsubsecentry{Filename Expansion}{3.5.8}{Filename Expansion}{25}
|
||||
@numsubsubsecentry{Pattern Matching}{3.5.8.1}{Pattern Matching}{26}
|
||||
@numsubsecentry{Quote Removal}{3.5.9}{Quote Removal}{27}
|
||||
@numsecentry{Redirections}{3.6}{Redirections}{27}
|
||||
@numsubsecentry{Redirecting Input}{3.6.1}{}{28}
|
||||
@numsubsecentry{Redirecting Output}{3.6.2}{}{28}
|
||||
@numsubsecentry{Redirecting Output}{3.6.2}{}{29}
|
||||
@numsubsecentry{Appending Redirected Output}{3.6.3}{}{29}
|
||||
@numsubsecentry{Redirecting Standard Output and Standard Error}{3.6.4}{}{29}
|
||||
@numsubsecentry{Appending Standard Output and Standard Error}{3.6.5}{}{29}
|
||||
@numsubsecentry{Here Documents}{3.6.6}{}{29}
|
||||
@numsubsecentry{Here Documents}{3.6.6}{}{30}
|
||||
@numsubsecentry{Here Strings}{3.6.7}{}{30}
|
||||
@numsubsecentry{Duplicating File Descriptors}{3.6.8}{}{30}
|
||||
@numsubsecentry{Moving File Descriptors}{3.6.9}{}{30}
|
||||
@numsubsecentry{Moving File Descriptors}{3.6.9}{}{31}
|
||||
@numsubsecentry{Opening File Descriptors for Reading and Writing}{3.6.10}{}{31}
|
||||
@numsecentry{Executing Commands}{3.7}{Executing Commands}{31}
|
||||
@numsubsecentry{Simple Command Expansion}{3.7.1}{Simple Command Expansion}{31}
|
||||
@numsubsecentry{Command Search and Execution}{3.7.2}{Command Search and Execution}{31}
|
||||
@numsubsecentry{Command Search and Execution}{3.7.2}{Command Search and Execution}{32}
|
||||
@numsubsecentry{Command Execution Environment}{3.7.3}{Command Execution Environment}{32}
|
||||
@numsubsecentry{Environment}{3.7.4}{Environment}{33}
|
||||
@numsubsecentry{Exit Status}{3.7.5}{Exit Status}{33}
|
||||
@numsubsecentry{Exit Status}{3.7.5}{Exit Status}{34}
|
||||
@numsubsecentry{Signals}{3.7.6}{Signals}{34}
|
||||
@numsecentry{Shell Scripts}{3.8}{Shell Scripts}{35}
|
||||
@numchapentry{Shell Builtin Commands}{4}{Shell Builtin Commands}{37}
|
||||
@numsecentry{Bourne Shell Builtins}{4.1}{Bourne Shell Builtins}{37}
|
||||
@numsecentry{Bash Builtin Commands}{4.2}{Bash Builtins}{43}
|
||||
@numsecentry{Modifying Shell Behavior}{4.3}{Modifying Shell Behavior}{53}
|
||||
@numsecentry{Bash Builtin Commands}{4.2}{Bash Builtins}{44}
|
||||
@numsecentry{Modifying Shell Behavior}{4.3}{Modifying Shell Behavior}{54}
|
||||
@numsubsecentry{The Set Builtin}{4.3.1}{The Set Builtin}{54}
|
||||
@numsubsecentry{The Shopt Builtin}{4.3.2}{The Shopt Builtin}{57}
|
||||
@numsecentry{Special Builtins}{4.4}{Special Builtins}{62}
|
||||
@numsubsecentry{The Shopt Builtin}{4.3.2}{The Shopt Builtin}{58}
|
||||
@numsecentry{Special Builtins}{4.4}{Special Builtins}{63}
|
||||
@numchapentry{Shell Variables}{5}{Shell Variables}{65}
|
||||
@numsecentry{Bourne Shell Variables}{5.1}{Bourne Shell Variables}{65}
|
||||
@numsecentry{Bash Variables}{5.2}{Bash Variables}{65}
|
||||
@@ -79,7 +79,7 @@
|
||||
@numsecentry{Arrays}{6.7}{Arrays}{84}
|
||||
@numsecentry{The Directory Stack}{6.8}{The Directory Stack}{85}
|
||||
@numsubsecentry{Directory Stack Builtins}{6.8.1}{Directory Stack Builtins}{85}
|
||||
@numsecentry{Controlling the Prompt}{6.9}{Printing a Prompt}{86}
|
||||
@numsecentry{Controlling the Prompt}{6.9}{Controlling the Prompt}{87}
|
||||
@numsecentry{The Restricted Shell}{6.10}{The Restricted Shell}{88}
|
||||
@numsecentry{Bash POSIX Mode}{6.11}{Bash POSIX Mode}{88}
|
||||
@numchapentry{Job Control}{7}{Job Control}{93}
|
||||
@@ -114,7 +114,7 @@
|
||||
@numsecentry{Bash History Facilities}{9.1}{Bash History Facilities}{127}
|
||||
@numsecentry{Bash History Builtins}{9.2}{Bash History Builtins}{127}
|
||||
@numsecentry{History Expansion}{9.3}{History Interaction}{129}
|
||||
@numsubsecentry{Event Designators}{9.3.1}{Event Designators}{129}
|
||||
@numsubsecentry{Event Designators}{9.3.1}{Event Designators}{130}
|
||||
@numsubsecentry{Word Designators}{9.3.2}{Word Designators}{130}
|
||||
@numsubsecentry{Modifiers}{9.3.3}{Modifiers}{131}
|
||||
@numchapentry{Installing Bash}{10}{Installing Bash}{133}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
\entry{$}{18}{\code {$}}
|
||||
\entry{!}{18}{\code {!}}
|
||||
\entry{0}{18}{\code {0}}
|
||||
\entry{_}{18}{\code {_}}
|
||||
\entry{_}{19}{\code {_}}
|
||||
\entry{CDPATH}{65}{\code {CDPATH}}
|
||||
\entry{HOME}{65}{\code {HOME}}
|
||||
\entry{IFS}{65}{\code {IFS}}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
\initial {@}
|
||||
\entry {\code {@}}{18}
|
||||
\initial {_}
|
||||
\entry {\code {_}}{18}
|
||||
\entry {\code {_}}{19}
|
||||
\initial {0}
|
||||
\entry {\code {0}}{18}
|
||||
\initial {A}
|
||||
|
||||
+578
-560
File diff suppressed because it is too large
Load Diff
+1442
-1405
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -18,7 +18,7 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
|
||||
|
||||
+o specifying command names containing //
|
||||
|
||||
+o specifying a file name containing a // as an argument to the ..
|
||||
+o specifying a filename containing a // as an argument to the ..
|
||||
builtin command
|
||||
|
||||
+o specifying a filename containing a slash as an argument to the
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
%!PS-Adobe-3.0
|
||||
%%Creator: groff version 1.19.2
|
||||
%%CreationDate: Fri Jul 8 17:23:38 2011
|
||||
%%CreationDate: Mon Sep 26 10:56:08 2011
|
||||
%%DocumentNeededResources: font Times-Roman
|
||||
%%+ font Times-Bold
|
||||
%%DocumentSuppliedResources: procset grops 1.19 2
|
||||
@@ -245,7 +245,7 @@ E F0(\(1\))A F1(RESTRICTED SHELL)72 112.8 Q F0(If)108 124.8 Q F2(bash)
|
||||
G(TH)-.189 E F4(,)A F3(ENV)2.25 E F4(,)A F0(or)2.25 E F3 -.27(BA)2.5 G
|
||||
(SH_ENV).27 E F0 32.5<8373>108 199.2 S
|
||||
(pecifying command names containing)-32.5 E F2(/)2.5 E F0 32.5<8373>108
|
||||
216 S(pecifying a \214le name containing a)-32.5 E F2(/)2.5 E F0
|
||||
216 S(pecifying a \214lename containing a)-32.5 E F2(/)2.5 E F0
|
||||
(as an ar)2.5 E(gument to the)-.18 E F2(.)2.5 E F0 -.2(bu)5 G
|
||||
(iltin command).2 E 32.5<8373>108 232.8 S .45
|
||||
(pecifying a \214lename containing a slash as an ar)-32.5 F .449
|
||||
|
||||
+31
-2
@@ -530,6 +530,10 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||
REDIRECT *my_undo_list, *exec_undo_list;
|
||||
volatile int last_pid;
|
||||
volatile int save_line_number;
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
volatile int ofifo, nfifo, osize, saved_fifo;
|
||||
volatile char *ofifo_list;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (command == 0 || breaking || continuing || read_but_dont_execute)
|
||||
@@ -670,6 +674,17 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||
if (shell_control_structure (command->type) && command->redirects)
|
||||
stdin_redir = stdin_redirects (command->redirects);
|
||||
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
if (variable_context != 0)
|
||||
{
|
||||
ofifo = num_fifos ();
|
||||
ofifo_list = copy_fifo_list (&osize);
|
||||
saved_fifo = 1;
|
||||
}
|
||||
else
|
||||
saved_fifo = 0;
|
||||
#endif
|
||||
|
||||
/* Handle WHILE FOR CASE etc. with redirections. (Also '&' input
|
||||
redirection.) */
|
||||
if (do_redirections (command->redirects, RX_ACTIVE|RX_UNDOABLE) != 0)
|
||||
@@ -677,6 +692,9 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||
cleanup_redirects (redirection_undo_list);
|
||||
redirection_undo_list = (REDIRECT *)NULL;
|
||||
dispose_exec_redirects ();
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
free (ofifo_list);
|
||||
#endif
|
||||
return (last_command_exit_value = EXECUTION_FAILURE);
|
||||
}
|
||||
|
||||
@@ -971,6 +989,16 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||
if (my_undo_list || exec_undo_list)
|
||||
discard_unwind_frame ("loop_redirections");
|
||||
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
if (saved_fifo)
|
||||
{
|
||||
nfifo = num_fifos ();
|
||||
if (nfifo > ofifo)
|
||||
close_new_fifos (ofifo_list, osize);
|
||||
free (ofifo_list);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Invert the return value if we have to */
|
||||
if (invert)
|
||||
exec_result = (exec_result == EXECUTION_SUCCESS)
|
||||
@@ -1001,6 +1029,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||
if (running_trap == 0)
|
||||
#endif
|
||||
currently_executing_command = (COMMAND *)NULL;
|
||||
|
||||
return (last_command_exit_value);
|
||||
}
|
||||
|
||||
@@ -4228,7 +4257,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
|
||||
|
||||
if (funcnest_max > 0 && funcnest >= funcnest_max)
|
||||
{
|
||||
internal_error ("%s: maximum function nesting level exceeded (%d)", var->name, funcnest);
|
||||
internal_error (_("%s: maximum function nesting level exceeded (%d)"), var->name, funcnest);
|
||||
funcnest = 0; /* XXX - should we reset it somewhere else? */
|
||||
jump_to_top_level (DISCARD);
|
||||
}
|
||||
@@ -5115,7 +5144,7 @@ shell_execve (command, args, env)
|
||||
#endif
|
||||
if (check_binary_file (sample, sample_len))
|
||||
{
|
||||
internal_error (_("%s: cannot execute binary file"), command);
|
||||
internal_error (_("%s: cannot execute binary file: %s"), command, strerror (i));
|
||||
return (EX_BINARY_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
+19
-3
@@ -592,7 +592,8 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||
close_pipes (pipe_in, pipe_out);
|
||||
|
||||
#if defined (PROCESS_SUBSTITUTION) && defined (HAVE_DEV_FD)
|
||||
unlink_fifo_list ();
|
||||
if (variable_context == 0) /* wait until shell function completes */
|
||||
unlink_fifo_list ();
|
||||
#endif
|
||||
/* If we are part of a pipeline, and not the end of the pipeline,
|
||||
then we should simply return and let the last command in the
|
||||
@@ -3668,6 +3669,11 @@ fix_assignment_words (words)
|
||||
{
|
||||
if (b == 0)
|
||||
{
|
||||
/* Posix (post-2008) says that `command' doesn't change whether
|
||||
or not the builtin it shadows is a `declaration command', even
|
||||
though it removes other special builtin properties. In Posix
|
||||
mode, we skip over one or more instances of `command' and
|
||||
deal with the next word as the assignment builtin. */
|
||||
while (posixly_correct && wcmd && wcmd->word && wcmd->word->word && STREQ (wcmd->word->word, "command"))
|
||||
wcmd = wcmd->next;
|
||||
b = builtin_address_internal (wcmd->word->word, 0);
|
||||
@@ -3689,6 +3695,8 @@ fix_assignment_words (words)
|
||||
{
|
||||
if (b == 0)
|
||||
{
|
||||
while (posixly_correct && wcmd && wcmd->word && wcmd->word->word && STREQ (wcmd->word->word, "command"))
|
||||
wcmd = wcmd->next;
|
||||
b = builtin_address_internal (wcmd->word->word, 0);
|
||||
if (b == 0 || (b->flags & ASSIGNMENT_BUILTIN) == 0)
|
||||
return;
|
||||
@@ -4220,7 +4228,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
|
||||
|
||||
if (funcnest_max > 0 && funcnest >= funcnest_max)
|
||||
{
|
||||
internal_error ("%s: maximum function nesting level exceeded (%d)", var->name, funcnest);
|
||||
internal_error (_("%s: maximum function nesting level exceeded (%d)"), var->name, funcnest);
|
||||
funcnest = 0; /* XXX - should we reset it somewhere else? */
|
||||
jump_to_top_level (DISCARD);
|
||||
}
|
||||
@@ -5107,7 +5115,7 @@ shell_execve (command, args, env)
|
||||
#endif
|
||||
if (check_binary_file (sample, sample_len))
|
||||
{
|
||||
internal_error (_("%s: cannot execute binary file"), command);
|
||||
internal_error (_("%s: cannot execute binary file: %s"), command, strerror (i));
|
||||
return (EX_BINARY_FILE);
|
||||
}
|
||||
}
|
||||
@@ -5176,6 +5184,14 @@ execute_intern_function (name, function)
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
|
||||
/* Posix interpretation 383 */
|
||||
if (posixly_correct && find_special_builtin (name->word))
|
||||
{
|
||||
internal_error (_("`%s': is a special builtin"), name->word);
|
||||
last_command_exit_value = EX_BADUSAGE;
|
||||
jump_to_top_level (ERREXIT);
|
||||
}
|
||||
|
||||
var = find_function (name->word);
|
||||
if (var && (readonly_p (var) || noassign_p (var)))
|
||||
{
|
||||
|
||||
@@ -206,6 +206,8 @@ rl_icppfunc_t *rl_directory_completion_hook = (rl_icppfunc_t *)NULL;
|
||||
|
||||
rl_icppfunc_t *rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
|
||||
|
||||
rl_icppfunc_t *rl_filename_stat_hook = (rl_icppfunc_t *)NULL;
|
||||
|
||||
/* If non-zero, this is the address of a function to call when reading
|
||||
directory entries from the filesystem for completion and comparing
|
||||
them to the partial word to be completed. The function should
|
||||
@@ -1695,6 +1697,8 @@ append_to_match (text, delimiter, quote_char, nontrivial_match)
|
||||
if (rl_filename_completion_desired)
|
||||
{
|
||||
filename = tilde_expand (text);
|
||||
if (rl_filename_stat_hook)
|
||||
(*rl_filename_stat_hook) (&filename);
|
||||
s = (nontrivial_match && rl_completion_mark_symlink_dirs == 0)
|
||||
? LSTAT (filename, &finfo)
|
||||
: stat (filename, &finfo);
|
||||
@@ -1714,8 +1718,7 @@ append_to_match (text, delimiter, quote_char, nontrivial_match)
|
||||
#ifdef S_ISLNK
|
||||
/* Don't add anything if the filename is a symlink and resolves to a
|
||||
directory. */
|
||||
else if (s == 0 && S_ISLNK (finfo.st_mode) &&
|
||||
stat (filename, &finfo) == 0 && S_ISDIR (finfo.st_mode))
|
||||
else if (s == 0 && S_ISLNK (finfo.st_mode) && path_isdir (filename))
|
||||
;
|
||||
#endif
|
||||
else
|
||||
|
||||
@@ -206,6 +206,8 @@ rl_icppfunc_t *rl_directory_completion_hook = (rl_icppfunc_t *)NULL;
|
||||
|
||||
rl_icppfunc_t *rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
|
||||
|
||||
rl_icppfunc_t *rl_directory_stat_hook = (rl_icppfunc_t *)NULL;
|
||||
|
||||
/* If non-zero, this is the address of a function to call when reading
|
||||
directory entries from the filesystem for completion and comparing
|
||||
them to the partial word to be completed. The function should
|
||||
@@ -1058,10 +1060,14 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
|
||||
variable rl_attempted_completion_function. */
|
||||
if (rl_attempted_completion_function)
|
||||
{
|
||||
#if 0
|
||||
_rl_interrupt_immediately++;
|
||||
#endif
|
||||
matches = (*rl_attempted_completion_function) (text, start, end);
|
||||
#if 0
|
||||
if (_rl_interrupt_immediately > 0)
|
||||
_rl_interrupt_immediately--;
|
||||
#endif
|
||||
|
||||
if (matches || rl_attempted_completion_over)
|
||||
{
|
||||
@@ -1691,6 +1697,8 @@ append_to_match (text, delimiter, quote_char, nontrivial_match)
|
||||
if (rl_filename_completion_desired)
|
||||
{
|
||||
filename = tilde_expand (text);
|
||||
if (rl_directory_stat_hook)
|
||||
(*rl_directory_stat_hook) (&filename);
|
||||
s = (nontrivial_match && rl_completion_mark_symlink_dirs == 0)
|
||||
? LSTAT (filename, &finfo)
|
||||
: stat (filename, &finfo);
|
||||
@@ -1710,8 +1718,7 @@ append_to_match (text, delimiter, quote_char, nontrivial_match)
|
||||
#ifdef S_ISLNK
|
||||
/* Don't add anything if the filename is a symlink and resolves to a
|
||||
directory. */
|
||||
else if (s == 0 && S_ISLNK (finfo.st_mode) &&
|
||||
stat (filename, &finfo) == 0 && S_ISDIR (finfo.st_mode))
|
||||
else if (s == 0 && S_ISLNK (finfo.st_mode) && path_isdir (filename))
|
||||
;
|
||||
#endif
|
||||
else
|
||||
@@ -1988,7 +1995,9 @@ rl_completion_matches (text, entry_function)
|
||||
match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
|
||||
match_list[1] = (char *)NULL;
|
||||
|
||||
#if 0
|
||||
_rl_interrupt_immediately++;
|
||||
#endif
|
||||
while (string = (*entry_function) (text, matches))
|
||||
{
|
||||
if (matches + 1 == match_list_size)
|
||||
@@ -1998,8 +2007,10 @@ rl_completion_matches (text, entry_function)
|
||||
match_list[++matches] = string;
|
||||
match_list[matches + 1] = (char *)NULL;
|
||||
}
|
||||
#if 0
|
||||
if (_rl_interrupt_immediately > 0)
|
||||
_rl_interrupt_immediately--;
|
||||
#endif
|
||||
|
||||
/* If there were any matches, then look through them finding out the
|
||||
lowest common denominator. That then becomes match_list[0]. */
|
||||
@@ -2233,8 +2244,9 @@ rl_filename_completion_function (text, state)
|
||||
}
|
||||
directory = opendir (dirname);
|
||||
|
||||
/* Now dequote a non-null filename. */
|
||||
if (filename && *filename && rl_completion_found_quote && rl_filename_dequoting_function)
|
||||
/* Now dequote a non-null filename. FILENAME will not be NULL, but may
|
||||
be empty. */
|
||||
if (*filename && rl_completion_found_quote && rl_filename_dequoting_function)
|
||||
{
|
||||
/* delete single and double quotes */
|
||||
temp = (*rl_filename_dequoting_function) (filename, rl_completion_quote_character);
|
||||
|
||||
@@ -1729,23 +1729,39 @@ the directory portion of the pathname the user typed.
|
||||
At the least, even if no other expansion is performed, this function should
|
||||
remove any quote characters from the directory name, because its result will
|
||||
be passed directly to @code{opendir()}.
|
||||
|
||||
The directory completion hook returns an integer that should be non-zero if
|
||||
the function modifies its directory argument.
|
||||
The function should not modify the directory argument if it returns 0.
|
||||
@end deftypevar
|
||||
|
||||
@ignore
|
||||
@deftypevar extern rl_icppfunc_t *rl_directory_rewrite_hook;
|
||||
@deftypevar {rl_icppfunc_t *} rl_directory_rewrite_hook;
|
||||
If non-zero, this is the address of a function to call when completing
|
||||
a directory name. This function takes the address of the directory name
|
||||
to be modified as an argument. Unlike @code{rl_directory_completion_hook},
|
||||
it only modifies the directory name used in @code{opendir}, not what is
|
||||
displayed when the possible completions are printed or inserted. It is
|
||||
called before rl_directory_completion_hook.
|
||||
At the least, even if no other expansion is performed, this function should
|
||||
remove any quote characters from the directory name, because its result will
|
||||
be passed directly to @code{opendir()}.
|
||||
|
||||
I'm not happy with how this works yet, so it's undocumented.
|
||||
The directory rewrite hook returns an integer that should be non-zero if
|
||||
the function modfies its directory argument.
|
||||
The function should not modify the directory argument if it returns 0.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {rl_icppfunc_t *} rl_filename_stat_hook
|
||||
If non-zero, this is the address of a function for the completer to
|
||||
call before deciding which character to append to a completed name.
|
||||
This function modifies its filename name argument, and the modified value
|
||||
is passed to @code{stat()} to determine the file's type and characteristics.
|
||||
This function does not need to remove quote characters from the filename.
|
||||
|
||||
The stat hook returns an integer that should be non-zero if
|
||||
the function modfies its directory argument.
|
||||
The function should not modify the directory argument if it returns 0.
|
||||
@end deftypevar
|
||||
@end ignore
|
||||
|
||||
@deftypevar {rl_dequote_func_t *} rl_filename_rewrite_hook
|
||||
If non-zero, this is the address of a function called when reading
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ Copyright (C) 1988-2011 Free Software Foundation, Inc.
|
||||
|
||||
@set EDITION 6.2
|
||||
@set VERSION 6.2
|
||||
@set UPDATED September 6 2010
|
||||
@set UPDATED-MONTH September 2010
|
||||
@set UPDATED October 2 2011
|
||||
@set UPDATED-MONTH October 2011
|
||||
|
||||
@set LASTCHANGE Mon Sep 6 22:07:10 EDT 2010
|
||||
@set LASTCHANGE Sun Oct 2 15:54:47 EDT 2011
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
@ignore
|
||||
Copyright (C) 1988-2011 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set EDITION 6.2
|
||||
@set VERSION 6.2
|
||||
@set UPDATED September 6 2010
|
||||
@set UPDATED-MONTH September 2010
|
||||
|
||||
@set LASTCHANGE Mon Sep 6 22:07:10 EDT 2010
|
||||
@@ -688,6 +688,13 @@ extern rl_icppfunc_t *rl_directory_completion_hook;
|
||||
it in bash to see how well it goes. */
|
||||
extern rl_icppfunc_t *rl_directory_rewrite_hook;
|
||||
|
||||
/* If non-zero, this is the address of a function for the completer to call
|
||||
before deciding which character to append to a completed name. It should
|
||||
modify the directory name passed as an argument if appropriate, and return
|
||||
non-zero if it modifies the name. This should not worry about dequoting
|
||||
the filename; that has already happened by the time it gets here. */
|
||||
extern rl_icppfunc_t *rl_filename_stat_hook;
|
||||
|
||||
/* If non-zero, this is the address of a function to call when reading
|
||||
directory entries from the filesystem for completion and comparing
|
||||
them to the partial word to be completed. The function should
|
||||
|
||||
+8
-4
@@ -718,11 +718,7 @@ pcomp_filename_completion_function (text, state)
|
||||
{
|
||||
FREE (dfn);
|
||||
/* remove backslashes quoting special characters in filenames. */
|
||||
#if 1
|
||||
if (RL_ISSTATE (RL_STATE_COMPLETING) && rl_filename_dequoting_function)
|
||||
#else
|
||||
if (rl_filename_dequoting_function)
|
||||
#endif
|
||||
{
|
||||
/* Use rl_completion_quote_character because any single or
|
||||
double quotes have been removed by the time TEXT makes it
|
||||
@@ -772,6 +768,7 @@ gen_action_completions (cs, text)
|
||||
STRINGLIST *ret, *tmatches;
|
||||
char **cmatches; /* from rl_completion_matches ... */
|
||||
unsigned long flags;
|
||||
int t;
|
||||
|
||||
ret = tmatches = (STRINGLIST *)NULL;
|
||||
flags = cs->actions;
|
||||
@@ -804,8 +801,15 @@ gen_action_completions (cs, text)
|
||||
/* And lastly, the special case for directories */
|
||||
if (flags & CA_DIRECTORY)
|
||||
{
|
||||
t = rl_filename_completion_desired;
|
||||
rl_completion_mark_symlink_dirs = 1; /* override user preference */
|
||||
cmatches = bash_directory_completion_matches (text);
|
||||
/* If we did not want filename completion before this, and there are
|
||||
no matches, turn off rl_filename_completion_desired so whatever
|
||||
matches we get are not treated as filenames (it gets turned on by
|
||||
rl_filename_completion_function unconditionally). */
|
||||
if (t == 0 && cmatches == 0 && rl_filename_completion_desired == 1)
|
||||
rl_filename_completion_desired = 0;
|
||||
tmatches = completions_to_stringlist (cmatches);
|
||||
ret = strlist_append (ret, tmatches);
|
||||
strvec_dispose (cmatches);
|
||||
|
||||
+1571
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,2 +1,2 @@
|
||||
# Set of available languages.
|
||||
en@quot en@boldquot af bg ca cs da de eo es et fi fr ga hu id ja lt nl pl pt_BR ro ru sk sl sv tr uk vi zh_CN zh_TW
|
||||
en@quot en@boldquot af bg ca cs da de eo es et fi fr ga gl hu id ja lt nl pl pt_BR ro ru sk sl sv tr uk vi zh_CN zh_TW
|
||||
|
||||
Reference in New Issue
Block a user