commit bash-20040422 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 12:56:49 -05:00
parent 1d7ecd770c
commit de8913bd20
51 changed files with 13071 additions and 634 deletions
+26
View File
@@ -9367,3 +9367,29 @@ builtins/alias.def
include/shmbutil.h
- include <config.h> for definition of HANDLE_MULTIBYTE rather than
duplicating logic
4/20
----
doc/{bash.1,bashref.texi}
- make sure $0 is consistently referred to as a `special parameter'
- document which characters are now not allowed in alias names
4/23
----
builtins/{jobs,kill,wait}.def
- removed requirement that job control be enabled to use job control
notation, as SUSv3 implies
subst.c
- based on a message from David Korn, change param_expand to not call
string_list_dollar_star if the only quoting is Q_HERE_DOCUMENT --
quoted here documents are like double quoting, but not exactly
- analogous changes to list_remove_pattern and pos_params
4/24
----
lib/readline/doc/rluser.texi
- fix error in description of emacs-mode C-xC-e command (uses $VISUAL
instead of $FCEDIT)
+25
View File
@@ -9362,3 +9362,28 @@ builtins/alias.def
- call legal_alias_name to make sure alias name is valid before
calling add_alias from alias_builtin
4/19
----
include/shmbutil.h
- include <config.h> for definition of HANDLE_MULTIBYTE rather than
duplicating logic
4/20
----
doc/{bash.1,bashref.texi}
- make sure $0 is consistently referred to as a `special parameter'
- document which characters are now not allowed in alias names
4/23
----
builtins/{jobs,kill,wait}.def
- removed requirement that job control be enabled to use job control
notation, as SUSv3 implies
subst.c
- based on a message from David Korn, change param_expand to not call
string_list_dollar_star if the only quoting is Q_HERE_DOCUMENT --
quoted here documents are like double quoting, but not exactly
- analogous changes to list_remove_pattern and pos_params
+3 -2
View File
@@ -1,7 +1,7 @@
This file is alias.def, from which is created alias.c
It implements the builtins "alias" and "unalias" in Bash.
Copyright (C) 1987-2002 Free Software Foundation, Inc.
Copyright (C) 1987-2004 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -44,6 +44,7 @@ $END
#endif
# include "../bashansi.h"
# include "../bashintl.h"
# include <stdio.h>
# include "../shell.h"
@@ -120,7 +121,7 @@ alias_builtin (list)
if (legal_alias_name (name, 0) == 0)
{
builtin_error ("%s: invalid alias name", name);
builtin_error (_("`%s': invalid alias name"), name);
any_failed++;
}
else
+1 -5
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
/* Copyright (C) 1987-2004 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -573,11 +573,7 @@ get_job_spec (list)
word = list->word->word;
if (*word == '\0')
#if 0
return (current_job);
#else
return (NO_JOB);
#endif
if (*word == '%')
word++;
-8
View File
@@ -573,11 +573,7 @@ get_job_spec (list)
word = list->word->word;
if (*word == '\0')
#if 0
return (current_job);
#else
return (NO_JOB);
#endif
if (*word == '%')
word++;
@@ -585,11 +581,7 @@ get_job_spec (list)
if (DIGIT (*word) && all_digits (word))
{
job = atoi (word);
#if 0
return (job >= job_slots ? NO_JOB : job - 1);
#else
return (job > job_slots ? NO_JOB : job - 1);
#endif
}
jflags = 0;
+1 -1
View File
@@ -1,6 +1,6 @@
/* common.h -- extern declarations for functions defined in common.c. */
/* Copyright (C) 1993-2002 Free Software Foundation, Inc.
/* Copyright (C) 1993-2004 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
+161
View File
@@ -0,0 +1,161 @@
/* common.h -- extern declarations for functions defined in common.c. */
/* Copyright (C) 1993-2002 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (__COMMON_H)
# define __COMMON_H
#include "stdc.h"
#define ISOPTION(s, c) (s[0] == '-' && !s[2] && s[1] == c)
/* Flag values for parse_and_execute () */
#define SEVAL_NONINT 0x001
#define SEVAL_INTERACT 0x002
#define SEVAL_NOHIST 0x004
#define SEVAL_NOFREE 0x008
#define SEVAL_RESETLINE 0x010
/* Flags for describe_command, shared between type.def and command.def */
#define CDESC_ALL 0x001 /* type -a */
#define CDESC_SHORTDESC 0x002 /* command -V */
#define CDESC_REUSABLE 0x004 /* command -v */
#define CDESC_TYPE 0x008 /* type -t */
#define CDESC_PATH_ONLY 0x010 /* type -p */
#define CDESC_FORCE_PATH 0x020 /* type -ap or type -P */
#define CDESC_NOFUNCS 0x040 /* type -f */
/* Flags for get_job_by_name */
#define JM_PREFIX 0x01 /* prefix of job name */
#define JM_SUBSTRING 0x02 /* substring of job name */
#define JM_EXACT 0x04 /* match job name exactly */
#define JM_STOPPED 0x08 /* match stopped jobs only */
#define JM_FIRSTMATCH 0x10 /* return first matching job */
/* Flags for remember_args and value of changed_dollar_vars */
#define ARGS_NONE 0x0
#define ARGS_INVOC 0x01
#define ARGS_FUNC 0x02
#define ARGS_SETBLTIN 0x04
/* Functions from common.c */
extern void builtin_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
extern void builtin_usage __P((void));
extern void no_args __P((WORD_LIST *));
extern int no_options __P((WORD_LIST *));
/* common error message functions */
extern void sh_needarg __P((char *));
extern void sh_neednumarg __P((char *));
extern void sh_notfound __P((char *));
extern void sh_invalidopt __P((char *));
extern void sh_invalidoptname __P((char *));
extern void sh_invalidid __P((char *));
extern void sh_invalidnum __P((char *));
extern void sh_invalidsig __P((char *));
extern void sh_erange __P((char *, char *));
extern void sh_badpid __P((char *));
extern void sh_badjob __P((char *));
extern void sh_readonly __P((const char *));
extern void sh_nojobs __P((char *));
extern void sh_restricted __P((char *));
extern void sh_notbuiltin __P((char *));
extern char **make_builtin_argv __P((WORD_LIST *, int *));
extern void remember_args __P((WORD_LIST *, int));
extern int dollar_vars_changed __P((void));
extern void set_dollar_vars_unchanged __P((void));
extern void set_dollar_vars_changed __P((void));
extern intmax_t get_numeric_arg __P((WORD_LIST *, int));
extern int get_exitstat __P((WORD_LIST *));
extern int read_octal __P((char *));
/* Keeps track of the current working directory. */
extern char *the_current_working_directory;
extern char *get_working_directory __P((char *));
extern void set_working_directory __P((char *));
#if defined (JOB_CONTROL)
extern int get_job_by_name __P((const char *, int));
extern int get_job_spec __P((WORD_LIST *));
#endif
extern int display_signal_list __P((WORD_LIST *, int));
/* It's OK to declare a function as returning a Function * without
providing a definition of what a `Function' is. */
extern struct builtin *builtin_address_internal __P((char *, int));
extern sh_builtin_func_t *find_shell_builtin __P((char *));
extern sh_builtin_func_t *builtin_address __P((char *));
extern sh_builtin_func_t *find_special_builtin __P((char *));
extern void initialize_shell_builtins __P((void));
/* Functions from exit.def */
extern void bash_logout __P((void));
/* Functions from getopts.def */
extern void getopts_reset __P((int));
/* Functions from set.def */
extern int minus_o_option_value __P((char *));
extern void list_minus_o_opts __P((int, int));
extern char **get_minus_o_opts __P((void));
extern int set_minus_o_option __P((int, char *));
extern void set_shellopts __P((void));
extern void parse_shellopts __P((char *));
extern void initialize_shell_options __P((int));
extern void reset_shell_options __P((void));
/* Functions from shopt.def */
extern void reset_shopt_options __P((void));
extern char **get_shopt_options __P((void));
extern int shopt_setopt __P((char *, int));
extern int shopt_listopt __P((char *, int));
extern int set_login_shell __P((int));
/* Functions from type.def */
extern int describe_command __P((char *, int));
/* Functions from setattr.def */
extern int set_or_show_attributes __P((WORD_LIST *, int, int));
extern int show_var_attributes __P((SHELL_VAR *, int, int));
extern int show_name_attributes __P((char *, int));
extern void set_var_attribute __P((char *, int, int));
/* Functions from pushd.def */
extern char *get_dirstack_from_string __P((char *));
extern char *get_dirstack_element __P((intmax_t, int));
extern void set_dirstack_element __P((intmax_t, int, char *));
extern WORD_LIST *get_directory_stack __P((void));
/* Functions from evalstring.c */
extern int parse_and_execute __P((char *, const char *, int));
extern void parse_and_execute_cleanup __P((void));
/* Functions from evalfile.c */
extern int maybe_execute_file __P((const char *, int));
extern int source_file __P((const char *, int));
extern int fc_execute_file __P((const char *));
#endif /* !__COMMON_H */
+1 -4
View File
@@ -1,7 +1,7 @@
This file is jobs.def, from which is created jobs.c.
It implements the builtins "jobs" and "disown" in Bash.
Copyright (C) 1987-2003 Free Software Foundation, Inc.
Copyright (C) 1987-2004 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -75,9 +75,6 @@ jobs_builtin (list)
int form, execute, state, opt, any_failed, job;
sigset_t set, oset;
if (job_control == 0 && interactive_shell == 0)
return (EXECUTION_SUCCESS);
execute = any_failed = 0;
form = JLIST_STANDARD;
state = JSTATE_ANY;
+281
View File
@@ -0,0 +1,281 @@
This file is jobs.def, from which is created jobs.c.
It implements the builtins "jobs" and "disown" in Bash.
Copyright (C) 1987-2003 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$PRODUCES jobs.c
$BUILTIN jobs
$FUNCTION jobs_builtin
$DEPENDS_ON JOB_CONTROL
$SHORT_DOC jobs [-lnprs] [jobspec ...] or jobs -x command [args]
Lists the active jobs. The -l option lists process id's in addition
to the normal information; the -p option lists process id's only.
If -n is given, only processes that have changed status since the last
notification are printed. JOBSPEC restricts output to that job. The
-r and -s options restrict output to running and stopped jobs only,
respectively. Without options, the status of all active jobs is
printed. If -x is given, COMMAND is run after all job specifications
that appear in ARGS have been replaced with the process ID of that job's
process group leader.
$END
#include <config.h>
#if defined (JOB_CONTROL)
#include "../bashtypes.h"
#include <signal.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "../bashansi.h"
#include "../bashintl.h"
#include "../shell.h"
#include "../jobs.h"
#include "../execute_cmd.h"
#include "bashgetopt.h"
#include "common.h"
#define JSTATE_ANY 0x0
#define JSTATE_RUNNING 0x1
#define JSTATE_STOPPED 0x2
static int execute_list_with_replacements __P((WORD_LIST *));
/* The `jobs' command. Prints outs a list of active jobs. If the
argument `-l' is given, then the process id's are printed also.
If the argument `-p' is given, print the process group leader's
pid only. If `-n' is given, only processes that have changed
status since the last notification are printed. If -x is given,
replace all job specs with the pid of the appropriate process
group leader and execute the command. The -r and -s options mean
to print info about running and stopped jobs only, respectively. */
int
jobs_builtin (list)
WORD_LIST *list;
{
int form, execute, state, opt, any_failed, job;
sigset_t set, oset;
if (job_control == 0 && interactive_shell == 0)
return (EXECUTION_SUCCESS);
execute = any_failed = 0;
form = JLIST_STANDARD;
state = JSTATE_ANY;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "lpnxrs")) != -1)
{
switch (opt)
{
case 'l':
form = JLIST_LONG;
break;
case 'p':
form = JLIST_PID_ONLY;
break;
case 'n':
form = JLIST_CHANGED_ONLY;
break;
case 'x':
if (form != JLIST_STANDARD)
{
builtin_error (_("no other options allowed with `-x'"));
return (EXECUTION_FAILURE);
}
execute++;
break;
case 'r':
state = JSTATE_RUNNING;
break;
case 's':
state = JSTATE_STOPPED;
break;
default:
builtin_usage ();
return (EX_USAGE);
}
}
list = loptend;
if (execute)
return (execute_list_with_replacements (list));
if (!list)
{
switch (state)
{
case JSTATE_ANY:
list_all_jobs (form);
break;
case JSTATE_RUNNING:
list_running_jobs (form);
break;
case JSTATE_STOPPED:
list_stopped_jobs (form);
break;
}
return (EXECUTION_SUCCESS);
}
while (list)
{
BLOCK_CHILD (set, oset);
job = get_job_spec (list);
if ((job == NO_JOB) || !jobs || !jobs[job])
{
sh_badjob (list->word->word);
any_failed++;
}
else if (job != DUP_JOB)
list_one_job ((JOB *)NULL, form, 0, job);
UNBLOCK_CHILD (oset);
list = list->next;
}
return (any_failed ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
}
static int
execute_list_with_replacements (list)
WORD_LIST *list;
{
register WORD_LIST *l;
int job, result;
COMMAND *command;
/* First do the replacement of job specifications with pids. */
for (l = list; l; l = l->next)
{
if (l->word->word[0] == '%') /* we have a winner */
{
job = get_job_spec (l);
/* A bad job spec is not really a job spec! Pass it through. */
if (job < 0 || job >= job_slots || !jobs[job])
continue;
free (l->word->word);
l->word->word = itos (jobs[job]->pgrp);
}
}
/* Next make a new simple command and execute it. */
begin_unwind_frame ("jobs_builtin");
command = make_bare_simple_command ();
command->value.Simple->words = copy_word_list (list);
command->value.Simple->redirects = (REDIRECT *)NULL;
command->flags |= CMD_INHIBIT_EXPANSION;
command->value.Simple->flags |= CMD_INHIBIT_EXPANSION;
add_unwind_protect (dispose_command, command);
result = execute_command (command);
dispose_command (command);
discard_unwind_frame ("jobs_builtin");
return (result);
}
#endif /* JOB_CONTROL */
$BUILTIN disown
$FUNCTION disown_builtin
$DEPENDS_ON JOB_CONTROL
$SHORT_DOC disown [-h] [-ar] [jobspec ...]
By default, removes each JOBSPEC argument from the table of active jobs.
If the -h option is given, the job is not removed from the table, but is
marked so that SIGHUP is not sent to the job if the shell receives a
SIGHUP. The -a option, when JOBSPEC is not supplied, means to remove all
jobs from the job table; the -r option means to remove only running jobs.
$END
#if defined (JOB_CONTROL)
int
disown_builtin (list)
WORD_LIST *list;
{
int opt, job, retval, nohup_only, running_jobs, all_jobs;
sigset_t set, oset;
intmax_t pid_value;
nohup_only = running_jobs = all_jobs = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "ahr")) != -1)
{
switch (opt)
{
case 'a':
all_jobs = 1;
break;
case 'h':
nohup_only = 1;
break;
case 'r':
running_jobs = 1;
break;
default:
builtin_usage ();
return (EX_USAGE);
}
}
list = loptend;
retval = EXECUTION_SUCCESS;
/* `disown -a' or `disown -r' */
if (list == 0 && (all_jobs || running_jobs))
{
if (nohup_only)
nohup_all_jobs (running_jobs);
else
delete_all_jobs (running_jobs);
return (EXECUTION_SUCCESS);
}
do
{
BLOCK_CHILD (set, oset);
job = (list && legal_number (list->word->word, &pid_value) && pid_value == (pid_t) pid_value)
? get_job_by_pid ((pid_t) pid_value, 0)
: get_job_spec (list);
if (job == NO_JOB || jobs == 0 || job < 0 || job >= job_slots || jobs[job] == 0)
{
sh_badjob (list ? list->word->word : "current");
retval = EXECUTION_FAILURE;
}
else if (nohup_only)
nohup_job (job);
else
delete_job (job, 1);
UNBLOCK_CHILD (oset);
if (list)
list = list->next;
}
while (list);
return (retval);
}
#endif /* JOB_CONTROL */
+283
View File
@@ -0,0 +1,283 @@
This file is jobs.def, from which is created jobs.c.
It implements the builtins "jobs" and "disown" in Bash.
Copyright (C) 1987-2003 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$PRODUCES jobs.c
$BUILTIN jobs
$FUNCTION jobs_builtin
$DEPENDS_ON JOB_CONTROL
$SHORT_DOC jobs [-lnprs] [jobspec ...] or jobs -x command [args]
Lists the active jobs. The -l option lists process id's in addition
to the normal information; the -p option lists process id's only.
If -n is given, only processes that have changed status since the last
notification are printed. JOBSPEC restricts output to that job. The
-r and -s options restrict output to running and stopped jobs only,
respectively. Without options, the status of all active jobs is
printed. If -x is given, COMMAND is run after all job specifications
that appear in ARGS have been replaced with the process ID of that job's
process group leader.
$END
#include <config.h>
#if defined (JOB_CONTROL)
#include "../bashtypes.h"
#include <signal.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "../bashansi.h"
#include "../bashintl.h"
#include "../shell.h"
#include "../jobs.h"
#include "../execute_cmd.h"
#include "bashgetopt.h"
#include "common.h"
#define JSTATE_ANY 0x0
#define JSTATE_RUNNING 0x1
#define JSTATE_STOPPED 0x2
static int execute_list_with_replacements __P((WORD_LIST *));
/* The `jobs' command. Prints outs a list of active jobs. If the
argument `-l' is given, then the process id's are printed also.
If the argument `-p' is given, print the process group leader's
pid only. If `-n' is given, only processes that have changed
status since the last notification are printed. If -x is given,
replace all job specs with the pid of the appropriate process
group leader and execute the command. The -r and -s options mean
to print info about running and stopped jobs only, respectively. */
int
jobs_builtin (list)
WORD_LIST *list;
{
int form, execute, state, opt, any_failed, job;
sigset_t set, oset;
#if 0
if (job_control == 0 && interactive_shell == 0)
return (EXECUTION_SUCCESS);
#endif
execute = any_failed = 0;
form = JLIST_STANDARD;
state = JSTATE_ANY;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "lpnxrs")) != -1)
{
switch (opt)
{
case 'l':
form = JLIST_LONG;
break;
case 'p':
form = JLIST_PID_ONLY;
break;
case 'n':
form = JLIST_CHANGED_ONLY;
break;
case 'x':
if (form != JLIST_STANDARD)
{
builtin_error (_("no other options allowed with `-x'"));
return (EXECUTION_FAILURE);
}
execute++;
break;
case 'r':
state = JSTATE_RUNNING;
break;
case 's':
state = JSTATE_STOPPED;
break;
default:
builtin_usage ();
return (EX_USAGE);
}
}
list = loptend;
if (execute)
return (execute_list_with_replacements (list));
if (!list)
{
switch (state)
{
case JSTATE_ANY:
list_all_jobs (form);
break;
case JSTATE_RUNNING:
list_running_jobs (form);
break;
case JSTATE_STOPPED:
list_stopped_jobs (form);
break;
}
return (EXECUTION_SUCCESS);
}
while (list)
{
BLOCK_CHILD (set, oset);
job = get_job_spec (list);
if ((job == NO_JOB) || !jobs || !jobs[job])
{
sh_badjob (list->word->word);
any_failed++;
}
else if (job != DUP_JOB)
list_one_job ((JOB *)NULL, form, 0, job);
UNBLOCK_CHILD (oset);
list = list->next;
}
return (any_failed ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
}
static int
execute_list_with_replacements (list)
WORD_LIST *list;
{
register WORD_LIST *l;
int job, result;
COMMAND *command;
/* First do the replacement of job specifications with pids. */
for (l = list; l; l = l->next)
{
if (l->word->word[0] == '%') /* we have a winner */
{
job = get_job_spec (l);
/* A bad job spec is not really a job spec! Pass it through. */
if (job < 0 || job >= job_slots || !jobs[job])
continue;
free (l->word->word);
l->word->word = itos (jobs[job]->pgrp);
}
}
/* Next make a new simple command and execute it. */
begin_unwind_frame ("jobs_builtin");
command = make_bare_simple_command ();
command->value.Simple->words = copy_word_list (list);
command->value.Simple->redirects = (REDIRECT *)NULL;
command->flags |= CMD_INHIBIT_EXPANSION;
command->value.Simple->flags |= CMD_INHIBIT_EXPANSION;
add_unwind_protect (dispose_command, command);
result = execute_command (command);
dispose_command (command);
discard_unwind_frame ("jobs_builtin");
return (result);
}
#endif /* JOB_CONTROL */
$BUILTIN disown
$FUNCTION disown_builtin
$DEPENDS_ON JOB_CONTROL
$SHORT_DOC disown [-h] [-ar] [jobspec ...]
By default, removes each JOBSPEC argument from the table of active jobs.
If the -h option is given, the job is not removed from the table, but is
marked so that SIGHUP is not sent to the job if the shell receives a
SIGHUP. The -a option, when JOBSPEC is not supplied, means to remove all
jobs from the job table; the -r option means to remove only running jobs.
$END
#if defined (JOB_CONTROL)
int
disown_builtin (list)
WORD_LIST *list;
{
int opt, job, retval, nohup_only, running_jobs, all_jobs;
sigset_t set, oset;
intmax_t pid_value;
nohup_only = running_jobs = all_jobs = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "ahr")) != -1)
{
switch (opt)
{
case 'a':
all_jobs = 1;
break;
case 'h':
nohup_only = 1;
break;
case 'r':
running_jobs = 1;
break;
default:
builtin_usage ();
return (EX_USAGE);
}
}
list = loptend;
retval = EXECUTION_SUCCESS;
/* `disown -a' or `disown -r' */
if (list == 0 && (all_jobs || running_jobs))
{
if (nohup_only)
nohup_all_jobs (running_jobs);
else
delete_all_jobs (running_jobs);
return (EXECUTION_SUCCESS);
}
do
{
BLOCK_CHILD (set, oset);
job = (list && legal_number (list->word->word, &pid_value) && pid_value == (pid_t) pid_value)
? get_job_by_pid ((pid_t) pid_value, 0)
: get_job_spec (list);
if (job == NO_JOB || jobs == 0 || job < 0 || job >= job_slots || jobs[job] == 0)
{
sh_badjob (list ? list->word->word : "current");
retval = EXECUTION_FAILURE;
}
else if (nohup_only)
nohup_job (job);
else
delete_job (job, 1);
UNBLOCK_CHILD (oset);
if (list)
list = list->next;
}
while (list);
return (retval);
}
#endif /* JOB_CONTROL */
+2 -2
View File
@@ -1,7 +1,7 @@
This file is kill.def, from which is created kill.c.
It implements the builtin "kill" in Bash.
Copyright (C) 1987-2003 Free Software Foundation, Inc.
Copyright (C) 1987-2004 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -187,7 +187,7 @@ kill_builtin (list)
builtin_error (_("%s: arguments must be process or job IDs"), list->word->word);
CONTINUE_OR_FAIL;
}
else if (*word && (interactive || job_control))
else if (*word)
/* Posix.2 says you can kill without job control active (4.32.4) */
{ /* Must be a job spec. Check it out. */
int job;
+250
View File
@@ -0,0 +1,250 @@
This file is kill.def, from which is created kill.c.
It implements the builtin "kill" in Bash.
Copyright (C) 1987-2003 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$PRODUCES kill.c
$BUILTIN kill
$FUNCTION kill_builtin
$SHORT_DOC kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
Send the processes named by PID (or JOB) the signal SIGSPEC. If
SIGSPEC is not present, then SIGTERM is assumed. An argument of `-l'
lists the signal names; if arguments follow `-l' they are assumed to
be signal numbers for which names should be listed. Kill is a shell
builtin for two reasons: it allows job IDs to be used instead of
process IDs, and, if you have reached the limit on processes that
you can create, you don't have to start a process to kill another one.
$END
#include <config.h>
#include <stdio.h>
#include <errno.h>
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include <sys/types.h>
# endif
# include <unistd.h>
#endif
#include "../bashansi.h"
#include "../bashintl.h"
#include "../shell.h"
#include "../trap.h"
#include "../jobs.h"
#include "common.h"
/* Not all systems declare ERRNO in errno.h... and some systems #define it! */
#if !defined (errno)
extern int errno;
#endif /* !errno */
extern int posixly_correct;
static void kill_error __P((pid_t, int));
#if !defined (CONTINUE_AFTER_KILL_ERROR)
# define CONTINUE_OR_FAIL return (EXECUTION_FAILURE)
#else
# define CONTINUE_OR_FAIL goto continue_killing
#endif /* CONTINUE_AFTER_KILL_ERROR */
/* Here is the kill builtin. We only have it so that people can type
kill -KILL %1? No, if you fill up the process table this way you
can still kill some. */
int
kill_builtin (list)
WORD_LIST *list;
{
int sig, any_succeeded, listing, saw_signal, dflags;
char *sigspec, *word;
pid_t pid;
intmax_t pid_value;
if (list == 0)
{
builtin_usage ();
return (EXECUTION_FAILURE);
}
any_succeeded = listing = saw_signal = 0;
sig = SIGTERM;
sigspec = "TERM";
dflags = DSIG_NOCASE | ((posixly_correct == 0) ? DSIG_SIGPREFIX : 0);
/* Process options. */
while (list)
{
word = list->word->word;
if (ISOPTION (word, 'l'))
{
listing++;
list = list->next;
}
else if (ISOPTION (word, 's') || ISOPTION (word, 'n'))
{
list = list->next;
if (list)
{
sigspec = list->word->word;
if (sigspec[0] == '0' && sigspec[1] == '\0')
sig = 0;
else
sig = decode_signal (sigspec, dflags);
list = list->next;
}
else
{
sh_needarg (word);
return (EXECUTION_FAILURE);
}
}
else if (ISOPTION (word, '-'))
{
list = list->next;
break;
}
else if (ISOPTION (word, '?'))
{
builtin_usage ();
return (EXECUTION_SUCCESS);
}
/* If this is a signal specification then process it. We only process
the first one seen; other arguments may signify process groups (e.g,
-num == process group num). */
else if ((*word == '-') && !saw_signal)
{
sigspec = word + 1;
sig = decode_signal (sigspec, dflags);
saw_signal++;
list = list->next;
}
else
break;
}
if (listing)
return (display_signal_list (list, 0));
/* OK, we are killing processes. */
if (sig == NO_SIG)
{
sh_invalidsig (sigspec);
return (EXECUTION_FAILURE);
}
if (list == 0)
{
builtin_usage ();
return (EXECUTION_FAILURE);
}
while (list)
{
word = list->word->word;
if (*word == '-')
word++;
/* Use the entire argument in case of minus sign presence. */
if (*word && legal_number (list->word->word, &pid_value) && (pid_value == (pid_t)pid_value))
{
pid = (pid_t) pid_value;
if ((pid < -1 ? kill_pid (-pid, sig, 1) : kill_pid (pid, sig, 0)) < 0)
{
if (errno == EINVAL)
sh_invalidsig (sigspec);
else
kill_error (pid, errno);
CONTINUE_OR_FAIL;
}
else
any_succeeded++;
}
#if defined (JOB_CONTROL)
else if (*list->word->word && *list->word->word != '%')
{
builtin_error (_("%s: arguments must be process or job IDs"), list->word->word);
CONTINUE_OR_FAIL;
}
else if (*word && (interactive || job_control))
/* Posix.2 says you can kill without job control active (4.32.4) */
{ /* Must be a job spec. Check it out. */
int job;
sigset_t set, oset;
BLOCK_CHILD (set, oset);
job = get_job_spec (list);
if (job < 0 || job >= job_slots || !jobs[job])
{
if (job != DUP_JOB)
sh_badjob (list->word->word);
UNBLOCK_CHILD (oset);
CONTINUE_OR_FAIL;
}
/* Job spec used. Kill the process group. If the job was started
without job control, then its pgrp == shell_pgrp, so we have
to be careful. We take the pid of the first job in the pipeline
in that case. */
pid = IS_JOBCONTROL (job) ? jobs[job]->pgrp : jobs[job]->pipe->pid;
UNBLOCK_CHILD (oset);
if (kill_pid (pid, sig, 1) < 0)
{
if (errno == EINVAL)
sh_invalidsig (sigspec);
else
kill_error (pid, errno);
CONTINUE_OR_FAIL;
}
else
any_succeeded++;
}
#endif /* !JOB_CONTROL */
else
{
sh_badpid (list->word->word);
CONTINUE_OR_FAIL;
}
continue_killing:
list = list->next;
}
return (any_succeeded ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
}
static void
kill_error (pid, e)
pid_t pid;
int e;
{
char *x;
x = strerror (e);
if (x == 0)
x = _("Unknown error");
builtin_error ("(%ld) - %s", (long)pid, x);
}
+250
View File
@@ -0,0 +1,250 @@
This file is kill.def, from which is created kill.c.
It implements the builtin "kill" in Bash.
Copyright (C) 1987-2003 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$PRODUCES kill.c
$BUILTIN kill
$FUNCTION kill_builtin
$SHORT_DOC kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
Send the processes named by PID (or JOB) the signal SIGSPEC. If
SIGSPEC is not present, then SIGTERM is assumed. An argument of `-l'
lists the signal names; if arguments follow `-l' they are assumed to
be signal numbers for which names should be listed. Kill is a shell
builtin for two reasons: it allows job IDs to be used instead of
process IDs, and, if you have reached the limit on processes that
you can create, you don't have to start a process to kill another one.
$END
#include <config.h>
#include <stdio.h>
#include <errno.h>
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include <sys/types.h>
# endif
# include <unistd.h>
#endif
#include "../bashansi.h"
#include "../bashintl.h"
#include "../shell.h"
#include "../trap.h"
#include "../jobs.h"
#include "common.h"
/* Not all systems declare ERRNO in errno.h... and some systems #define it! */
#if !defined (errno)
extern int errno;
#endif /* !errno */
extern int posixly_correct;
static void kill_error __P((pid_t, int));
#if !defined (CONTINUE_AFTER_KILL_ERROR)
# define CONTINUE_OR_FAIL return (EXECUTION_FAILURE)
#else
# define CONTINUE_OR_FAIL goto continue_killing
#endif /* CONTINUE_AFTER_KILL_ERROR */
/* Here is the kill builtin. We only have it so that people can type
kill -KILL %1? No, if you fill up the process table this way you
can still kill some. */
int
kill_builtin (list)
WORD_LIST *list;
{
int sig, any_succeeded, listing, saw_signal, dflags;
char *sigspec, *word;
pid_t pid;
intmax_t pid_value;
if (list == 0)
{
builtin_usage ();
return (EXECUTION_FAILURE);
}
any_succeeded = listing = saw_signal = 0;
sig = SIGTERM;
sigspec = "TERM";
dflags = DSIG_NOCASE | ((posixly_correct == 0) ? DSIG_SIGPREFIX : 0);
/* Process options. */
while (list)
{
word = list->word->word;
if (ISOPTION (word, 'l'))
{
listing++;
list = list->next;
}
else if (ISOPTION (word, 's') || ISOPTION (word, 'n'))
{
list = list->next;
if (list)
{
sigspec = list->word->word;
if (sigspec[0] == '0' && sigspec[1] == '\0')
sig = 0;
else
sig = decode_signal (sigspec, dflags);
list = list->next;
}
else
{
sh_needarg (word);
return (EXECUTION_FAILURE);
}
}
else if (ISOPTION (word, '-'))
{
list = list->next;
break;
}
else if (ISOPTION (word, '?'))
{
builtin_usage ();
return (EXECUTION_SUCCESS);
}
/* If this is a signal specification then process it. We only process
the first one seen; other arguments may signify process groups (e.g,
-num == process group num). */
else if ((*word == '-') && !saw_signal)
{
sigspec = word + 1;
sig = decode_signal (sigspec, dflags);
saw_signal++;
list = list->next;
}
else
break;
}
if (listing)
return (display_signal_list (list, 0));
/* OK, we are killing processes. */
if (sig == NO_SIG)
{
sh_invalidsig (sigspec);
return (EXECUTION_FAILURE);
}
if (list == 0)
{
builtin_usage ();
return (EXECUTION_FAILURE);
}
while (list)
{
word = list->word->word;
if (*word == '-')
word++;
/* Use the entire argument in case of minus sign presence. */
if (*word && legal_number (list->word->word, &pid_value) && (pid_value == (pid_t)pid_value))
{
pid = (pid_t) pid_value;
if ((pid < -1 ? kill_pid (-pid, sig, 1) : kill_pid (pid, sig, 0)) < 0)
{
if (errno == EINVAL)
sh_invalidsig (sigspec);
else
kill_error (pid, errno);
CONTINUE_OR_FAIL;
}
else
any_succeeded++;
}
#if defined (JOB_CONTROL)
else if (*list->word->word && *list->word->word != '%')
{
builtin_error (_("%s: arguments must be process or job IDs"), list->word->word);
CONTINUE_OR_FAIL;
}
else if (*word)
/* Posix.2 says you can kill without job control active (4.32.4) */
{ /* Must be a job spec. Check it out. */
int job;
sigset_t set, oset;
BLOCK_CHILD (set, oset);
job = get_job_spec (list);
if (job < 0 || job >= job_slots || !jobs[job])
{
if (job != DUP_JOB)
sh_badjob (list->word->word);
UNBLOCK_CHILD (oset);
CONTINUE_OR_FAIL;
}
/* Job spec used. Kill the process group. If the job was started
without job control, then its pgrp == shell_pgrp, so we have
to be careful. We take the pid of the first job in the pipeline
in that case. */
pid = IS_JOBCONTROL (job) ? jobs[job]->pgrp : jobs[job]->pipe->pid;
UNBLOCK_CHILD (oset);
if (kill_pid (pid, sig, 1) < 0)
{
if (errno == EINVAL)
sh_invalidsig (sigspec);
else
kill_error (pid, errno);
CONTINUE_OR_FAIL;
}
else
any_succeeded++;
}
#endif /* !JOB_CONTROL */
else
{
sh_badpid (list->word->word);
CONTINUE_OR_FAIL;
}
continue_killing:
list = list->next;
}
return (any_succeeded ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
}
static void
kill_error (pid, e)
pid_t pid;
int e;
{
char *x;
x = strerror (e);
if (x == 0)
x = _("Unknown error");
builtin_error ("(%ld) - %s", (long)pid, x);
}
+2 -8
View File
@@ -1,7 +1,7 @@
This file is wait.def, from which is created wait.c.
It implements the builtin "wait" in Bash.
Copyright (C) 1987-2002 Free Software Foundation, Inc.
Copyright (C) 1987-2004 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -141,7 +141,7 @@ wait_builtin (list)
}
}
#if defined (JOB_CONTROL)
else if (job_control && *w)
else if (*w && *w == '%')
/* Must be a job spec. Check it out. */
{
int job;
@@ -164,12 +164,6 @@ wait_builtin (list)
UNBLOCK_CHILD (oset);
status = wait_for_job (job);
}
else if (job_control == 0 && *w == '%')
{
/* can't use jobspecs as arguments if job control is not active. */
sh_nojobs ((char *)NULL);
status = EXECUTION_FAILURE;
}
#endif /* JOB_CONTROL */
else
{
+183
View File
@@ -0,0 +1,183 @@
This file is wait.def, from which is created wait.c.
It implements the builtin "wait" in Bash.
Copyright (C) 1987-2002 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$BUILTIN wait
$FUNCTION wait_builtin
$DEPENDS_ON JOB_CONTROL
$PRODUCES wait.c
$SHORT_DOC wait [n]
Wait for the specified process and report its termination status. If
N is not given, all currently active child processes are waited for,
and the return code is zero. N may be a process ID or a job
specification; if a job spec is given, all processes in the job's
pipeline are waited for.
$END
$BUILTIN wait
$FUNCTION wait_builtin
$DEPENDS_ON !JOB_CONTROL
$SHORT_DOC wait [n]
Wait for the specified process and report its termination status. If
N is not given, all currently active child processes are waited for,
and the return code is zero. N is a process ID; if it is not given,
all child processes of the shell are waited for.
$END
#include <config.h>
#include "../bashtypes.h"
#include <signal.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include <chartypes.h>
#include "../bashansi.h"
#include "../shell.h"
#include "../jobs.h"
#include "common.h"
#include "bashgetopt.h"
extern int interrupt_immediately;
extern int wait_signal_received;
procenv_t wait_intr_buf;
/* Wait for the pid in LIST to stop or die. If no arguments are given, then
wait for all of the active background processes of the shell and return
0. If a list of pids or job specs are given, return the exit status of
the last one waited for. */
#define WAIT_RETURN(s) \
do \
{ \
interrupt_immediately = old_interrupt_immediately;\
return (s);\
} \
while (0)
int
wait_builtin (list)
WORD_LIST *list;
{
int status, code;
volatile int old_interrupt_immediately;
USE_VAR(list);
if (no_options (list))
return (EX_USAGE);
list = loptend;
old_interrupt_immediately = interrupt_immediately;
interrupt_immediately++;
/* POSIX.2 says: When the shell is waiting (by means of the wait utility)
for asynchronous commands to complete, the reception of a signal for
which a trap has been set shall cause the wait utility to return
immediately with an exit status greater than 128, after which the trap
associated with the signal shall be taken.
We handle SIGINT here; it's the only one that needs to be treated
specially (I think), since it's handled specially in {no,}jobs.c. */
code = setjmp (wait_intr_buf);
if (code)
{
status = 128 + wait_signal_received;
WAIT_RETURN (status);
}
/* We support jobs or pids.
wait <pid-or-job> [pid-or-job ...] */
/* But wait without any arguments means to wait for all of the shell's
currently active background processes. */
if (list == 0)
{
wait_for_background_pids ();
WAIT_RETURN (EXECUTION_SUCCESS);
}
status = EXECUTION_SUCCESS;
while (list)
{
pid_t pid;
char *w;
intmax_t pid_value;
w = list->word->word;
if (DIGIT (*w))
{
if (legal_number (w, &pid_value) && pid_value == (pid_t)pid_value)
{
pid = (pid_t)pid_value;
status = wait_for_single_pid (pid);
}
else
{
sh_badpid (w);
WAIT_RETURN (EXECUTION_FAILURE);
}
}
#if defined (JOB_CONTROL)
else if (job_control && *w)
/* Must be a job spec. Check it out. */
{
int job;
sigset_t set, oset;
BLOCK_CHILD (set, oset);
job = get_job_spec (list);
if (job < 0 || job >= job_slots || !jobs[job])
{
if (job != DUP_JOB)
sh_badjob (list->word->word);
UNBLOCK_CHILD (oset);
status = 127; /* As per Posix.2, section 4.70.2 */
list = list->next;
continue;
}
/* Job spec used. Wait for the last pid in the pipeline. */
UNBLOCK_CHILD (oset);
status = wait_for_job (job);
}
else if (job_control == 0 && *w == '%')
{
/* can't use jobspecs as arguments if job control is not active. */
sh_nojobs ((char *)NULL);
status = EXECUTION_FAILURE;
}
#endif /* JOB_CONTROL */
else
{
sh_badpid (w);
status = EXECUTION_FAILURE;
}
list = list->next;
}
WAIT_RETURN (status);
}
+177
View File
@@ -0,0 +1,177 @@
This file is wait.def, from which is created wait.c.
It implements the builtin "wait" in Bash.
Copyright (C) 1987-2004 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$BUILTIN wait
$FUNCTION wait_builtin
$DEPENDS_ON JOB_CONTROL
$PRODUCES wait.c
$SHORT_DOC wait [n]
Wait for the specified process and report its termination status. If
N is not given, all currently active child processes are waited for,
and the return code is zero. N may be a process ID or a job
specification; if a job spec is given, all processes in the job's
pipeline are waited for.
$END
$BUILTIN wait
$FUNCTION wait_builtin
$DEPENDS_ON !JOB_CONTROL
$SHORT_DOC wait [n]
Wait for the specified process and report its termination status. If
N is not given, all currently active child processes are waited for,
and the return code is zero. N is a process ID; if it is not given,
all child processes of the shell are waited for.
$END
#include <config.h>
#include "../bashtypes.h"
#include <signal.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include <chartypes.h>
#include "../bashansi.h"
#include "../shell.h"
#include "../jobs.h"
#include "common.h"
#include "bashgetopt.h"
extern int interrupt_immediately;
extern int wait_signal_received;
procenv_t wait_intr_buf;
/* Wait for the pid in LIST to stop or die. If no arguments are given, then
wait for all of the active background processes of the shell and return
0. If a list of pids or job specs are given, return the exit status of
the last one waited for. */
#define WAIT_RETURN(s) \
do \
{ \
interrupt_immediately = old_interrupt_immediately;\
return (s);\
} \
while (0)
int
wait_builtin (list)
WORD_LIST *list;
{
int status, code;
volatile int old_interrupt_immediately;
USE_VAR(list);
if (no_options (list))
return (EX_USAGE);
list = loptend;
old_interrupt_immediately = interrupt_immediately;
interrupt_immediately++;
/* POSIX.2 says: When the shell is waiting (by means of the wait utility)
for asynchronous commands to complete, the reception of a signal for
which a trap has been set shall cause the wait utility to return
immediately with an exit status greater than 128, after which the trap
associated with the signal shall be taken.
We handle SIGINT here; it's the only one that needs to be treated
specially (I think), since it's handled specially in {no,}jobs.c. */
code = setjmp (wait_intr_buf);
if (code)
{
status = 128 + wait_signal_received;
WAIT_RETURN (status);
}
/* We support jobs or pids.
wait <pid-or-job> [pid-or-job ...] */
/* But wait without any arguments means to wait for all of the shell's
currently active background processes. */
if (list == 0)
{
wait_for_background_pids ();
WAIT_RETURN (EXECUTION_SUCCESS);
}
status = EXECUTION_SUCCESS;
while (list)
{
pid_t pid;
char *w;
intmax_t pid_value;
w = list->word->word;
if (DIGIT (*w))
{
if (legal_number (w, &pid_value) && pid_value == (pid_t)pid_value)
{
pid = (pid_t)pid_value;
status = wait_for_single_pid (pid);
}
else
{
sh_badpid (w);
WAIT_RETURN (EXECUTION_FAILURE);
}
}
#if defined (JOB_CONTROL)
else if (*w)
/* Must be a job spec. Check it out. */
{
int job;
sigset_t set, oset;
BLOCK_CHILD (set, oset);
job = get_job_spec (list);
if (job < 0 || job >= job_slots || !jobs[job])
{
if (job != DUP_JOB)
sh_badjob (list->word->word);
UNBLOCK_CHILD (oset);
status = 127; /* As per Posix.2, section 4.70.2 */
list = list->next;
continue;
}
/* Job spec used. Wait for the last pid in the pipeline. */
UNBLOCK_CHILD (oset);
status = wait_for_job (job);
}
#endif /* JOB_CONTROL */
else
{
sh_badpid (w);
status = EXECUTION_FAILURE;
}
list = list->next;
}
WAIT_RETURN (status);
}
+22 -22
View File
@@ -1729,17 +1729,17 @@ AALLIIAASSEESS
the first word of a simple command. The shell maintains a list of
aliases that may be set and unset with the aalliiaass and uunnaalliiaass builtin
commands (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The first word of each
command, if unquoted, is checked to see if it has an alias. If so,
that word is replaced by the text of the alias. The alias name and the
replacement text may contain any valid shell input, including the
_m_e_t_a_c_h_a_r_a_c_t_e_r_s listed above, with the exception that the alias name may
not contain _=. The first word of the replacement text is tested for
aliases, but a word that is identical to an alias being expanded is not
expanded a second time. This means that one may alias llss to llss --FF, for
instance, and bbaasshh does not try to recursively expand the replacement
text. If the last character of the alias value is a _b_l_a_n_k, then the
next command word following the alias is also checked for alias expan-
sion.
simple command, if unquoted, is checked to see if it has an alias. If
so, that word is replaced by the text of the alias. The characters //,
$$, ``, and == and any of the shell _m_e_t_a_c_h_a_r_a_c_t_e_r_s or quoting characters
listed above may not appear in an alias name. The replacement text may
contain any valid shell input, including shell metacharacters. The
first word of the replacement text is tested for aliases, but a word
that is identical to an alias being expanded is not expanded a second
time. This means that one may alias llss to llss --FF, for instance, and
bbaasshh does not try to recursively expand the replacement text. If the
last character of the alias value is a _b_l_a_n_k, then the next command
word following the alias is also checked for alias expansion.
Aliases are created and listed with the aalliiaass command, and removed with
the uunnaalliiaass command.
@@ -1778,16 +1778,16 @@ FFUUNNCCTTIIOONNSS
interpret them (contrast this with the execution of a shell script).
When a function is executed, the arguments to the function become the
positional parameters during its execution. The special parameter ## is
updated to reflect the change. Positional parameter 0 is unchanged.
The first element of the FFUUNNCCNNAAMMEE variable is set to the name of the
function while the function is executing. All other aspects of the
shell execution environment are identical between a function and its
caller with the exception that the DDEEBBUUGG trap (see the description of
the ttrraapp builtin under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) is not inherited
unless the function has been given the ttrraaccee attribute (see the
description of the ddeeccllaarree builtin below) or the --oo ffuunnccttrraaccee shell
option has been enabled with the sseett builtin (in which case all func-
tions inherit the DDEEBBUUGG trap).
updated to reflect the change. Special parameter 0 is unchanged. The
first element of the FFUUNNCCNNAAMMEE variable is set to the name of the func-
tion while the function is executing. All other aspects of the shell
execution environment are identical between a function and its caller
with the exception that the DDEEBBUUGG trap (see the description of the ttrraapp
builtin under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) is not inherited unless the
function has been given the ttrraaccee attribute (see the description of the
ddeeccllaarree builtin below) or the --oo ffuunnccttrraaccee shell option has been
enabled with the sseett builtin (in which case all functions inherit the
DDEEBBUUGG trap).
Variables local to the function may be declared with the llooccaall builtin
command. Ordinarily, variables and their values are shared between the
@@ -4775,4 +4775,4 @@ BBUUGGSS
GNU Bash-3.0 2004 Jan 28 BASH(1)
GNU Bash-3.0 2004 Apr 20 BASH(1)
+12 -10
View File
@@ -6,12 +6,12 @@
.\" Case Western Reserve University
.\" chet@po.CWRU.Edu
.\"
.\" Last Change: Wed Jan 28 15:49:29 EST 2004
.\" Last Change: Tue Apr 20 13:39:08 EDT 2004
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2004 Jan 28" "GNU Bash-3.0"
.TH BASH 1 "2004 Apr 20" "GNU Bash-3.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -3189,16 +3189,18 @@ builtin commands (see
.SM
.B SHELL BUILTIN COMMANDS
below).
The first word of each command, if unquoted,
The first word of each simple command, if unquoted,
is checked to see if it has an
alias. If so, that word is replaced by the text of the alias.
The alias name and the replacement text may contain any valid
shell input, including the
.I metacharacters
listed above, with the exception that the alias name may not
contain \fI=\fP. The first word of the replacement text is tested
The characters \fB/\fP, \fB$\fP, \fB`\fP, and \fB=\fP and
any of the shell \fImetacharacters\fP or quoting characters
listed above may not appear in an alias name.
The replacement text may contain any valid shell input,
including shell metacharacters.
The first word of the replacement text is tested
for aliases, but a word that is identical to an alias being expanded
is not expanded a second time. This means that one may alias
is not expanded a second time.
This means that one may alias
.B ls
to
.BR "ls \-F" ,
@@ -3272,7 +3274,7 @@ function become the positional parameters
during its execution.
The special parameter
.B #
is updated to reflect the change. Positional parameter 0
is updated to reflect the change. Special parameter 0
is unchanged.
The first element of the
.SM
+12 -11
View File
@@ -2,7 +2,7 @@
<TITLE>BASH(1) Manual Page</TITLE>
</HEAD>
<BODY><TABLE WIDTH=100%>
<TH ALIGN=LEFT>BASH(1)<TH ALIGN=CENTER>2004 Jan 28<TH ALIGN=RIGHT>BASH(1)
<TH ALIGN=LEFT>BASH(1)<TH ALIGN=CENTER>2004 Apr 20<TH ALIGN=RIGHT>BASH(1)
</TABLE>
<BR><A HREF="#index">Index</A>
<HR>
@@ -4156,17 +4156,18 @@ builtin commands (see
</FONT>
below).
The first word of each command, if unquoted,
The first word of each simple command, if unquoted,
is checked to see if it has an
alias. If so, that word is replaced by the text of the alias.
The alias name and the replacement text may contain any valid
shell input, including the
<I>metacharacters</I>
listed above, with the exception that the alias name may not
contain <I>=</I>. The first word of the replacement text is tested
The characters <B>/</B>, <B>$</B>, <B>`</B>, and <B>=</B> and
any of the shell <I>metacharacters</I> or quoting characters
listed above may not appear in an alias name.
The replacement text may contain any valid shell input,
including shell metacharacters.
The first word of the replacement text is tested
for aliases, but a word that is identical to an alias being expanded
is not expanded a second time. This means that one may alias
is not expanded a second time.
This means that one may alias
<B>ls</B>
to
@@ -4260,7 +4261,7 @@ during its execution.
The special parameter
<B>#</B>
is updated to reflect the change. Positional parameter 0
is updated to reflect the change. Special parameter 0
is unchanged.
The first element of the
<FONT SIZE=-1><B>FUNCNAME</B>
@@ -11343,6 +11344,6 @@ Array variables may not (yet) be exported.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 29 January 2004 16:59:30 EST
Time: 20 April 2004 15:26:54 EDT
</BODY>
</HTML>
+152 -136
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.18.1
%%CreationDate: Thu Jan 29 16:59:28 2004
%%Creator: groff version 1.19
%%CreationDate: Tue Apr 20 15:26:44 2004
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
@@ -9,13 +9,17 @@
%%+ font Palatino-Roman
%%+ font Palatino-Italic
%%+ font Palatino-Bold
%%DocumentSuppliedResources: procset grops 1.18 1
%%DocumentSuppliedResources: procset grops 1.19 0
%%Pages: 63
%%PageOrder: Ascend
%%DocumentMedia: Default 612 792 0 () ()
%%Orientation: Portrait
%%EndComments
%%BeginDefaults
%%PageMedia: Default
%%EndDefaults
%%BeginProlog
%%BeginResource: procset grops 1.18 1
%%BeginResource: procset grops 1.19 0
/setpacking where{
pop
currentpacking
@@ -116,16 +120,22 @@ TM setmatrix
/Fr{
setrgbcolor fill
}bind def
/setcmykcolor where{
pop
/Fk{
setcmykcolor fill
}bind def
}if
/Fg{
setgray fill
}bind def
/FL/fill load def
/LW/setlinewidth load def
/Cr/setrgbcolor load def
/setcmykcolor where{
pop
/Ck/setcmykcolor load def
}if
/Cg/setgray load def
/RE{
findfont
@@ -168,6 +178,7 @@ newpath
/CNT countdictstack def
userdict begin
/showpage{}def
/setpagedevice{}def
}bind def
/PEND{
clear
@@ -180,6 +191,9 @@ pop
setpacking
}if
%%EndResource
%%BeginFeature: *PageSize Default
<< /PageSize [ 612 792 ] /ImagingBBox null >> setpagedevice
%%EndFeature
%%IncludeResource: font Times-Roman
%%IncludeResource: font Times-Bold
%%IncludeResource: font Times-Italic
@@ -321,7 +335,7 @@ E F2(po)2.5 E F0(\(portable object\) \214le format.)2.5 E F2
144 686.4 Q .3 -.15(ve \()-.25 H(see).15 E F4(INV)2.5 E(OCA)-.405 E
(TION)-.855 E F0(belo)2.25 E(w\).)-.25 E F2(\255\255login)108 703.2 Q F0
(Equi)144 715.2 Q -.25(va)-.25 G(lent to).25 E F2<ad6c>2.5 E F0(.)A
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(1)204.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(1)203.725 E 0 Cg EP
%%Page: 2 2
%%BeginPageSetup
BP
@@ -444,7 +458,7 @@ F(ariable)-.25 E F3 -.27(BA)108 679.2 S(SH_ENV).27 E F0 1.01(in the en)
108 727.2 S 2.5(tt).2 G(he v)-2.5 E(alue of the)-.25 E F3 -.666(PA)2.5 G
(TH)-.189 E F0 -.25(va)2.25 G
(riable is not used to search for the \214le name.).25 E(GNU Bash-3.0)72
768 Q(2004 Jan 28)149.845 E(2)204.835 E 0 Cg EP
768 Q(2004 Apr 20)148.735 E(2)203.725 E 0 Cg EP
%%Page: 3 3
%%BeginPageSetup
BP
@@ -569,7 +583,7 @@ F1(Pipelines)87 679.2 Q F0(A)108 691.2 Q F2(pipeline)2.919 E F0 .419
F F1(|)2.92 E F0 5.42(.T)C .42(he format for a pipeline)-5.42 F(is:)108
703.2 Q([)144 720 Q F1(time)A F0([)2.5 E F1<ad70>A F0(]] [ ! ])A F2
(command)2.5 E F0([)2.5 E F1(|)2.5 E F2(command2)2.5 E F0(... ])2.5 E
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(3)204.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(3)203.725 E 0 Cg EP
%%Page: 4 4
%%BeginPageSetup
BP
@@ -689,7 +703,7 @@ A({)108 573.6 Q F1(list)2.5 E F0 2.5(;})C F1(list)3.89 E F0 .402
F(SIONS)144 727.2 Q F5(.)A F0 -.8(Wo)5.633 G 1.133
(rd splitting and pathname e).8 F 1.133
(xpansion are not performed on the w)-.15 F 1.133(ords between the)-.1 F
F3([[)3.632 E F0(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(4)204.835 E
F3([[)3.632 E F0(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(4)203.725 E
0 Cg EP
%%Page: 5 5
%%BeginPageSetup
@@ -829,7 +843,7 @@ F F2(name)144 727.2 Q F0 .759(to be set to null.)3.439 F .759
(The line read is sa)5.759 F -.15(ve)-.2 G 3.26(di).15 G 3.26(nt)-3.26 G
.76(he v)-3.26 F(ariable)-.25 E F1(REPL)3.26 E(Y)-.92 E F0 5.76(.T)C(he)
-5.76 E F2(list)3.35 E F0 .76(is e)3.94 F -.15(xe)-.15 G .76
(cuted after).15 F(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(5)204.835
(cuted after).15 F(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(5)203.725
E 0 Cg EP
%%Page: 6 6
%%BeginPageSetup
@@ -965,7 +979,7 @@ E(xpansion.)-.15 E(There are three quoting mechanisms: the)108 708 Q F2
G(he)-2.974 E F2 .474(escape c)2.974 F(har)-.15 E(acter)-.15 E F0 5.474
(.I).73 G 2.974(tp)-5.474 G(reserv)-2.974 E .474(es the literal v)-.15 F
.474(alue of the ne)-.25 F .474(xt character that)-.15 F(GNU Bash-3.0)72
768 Q(2004 Jan 28)149.845 E(6)204.835 E 0 Cg EP
768 Q(2004 Apr 20)148.735 E(6)203.725 E 0 Cg EP
%%Page: 7 7
%%BeginPageSetup
BP
@@ -1082,7 +1096,7 @@ d by one or more digits, other than the single digit 0.)3.935 F(Posi-)
5.706 E .445(tional parameters are assigned from the shell')108 729.6 R
2.944(sa)-.55 G -.18(rg)-2.944 G .444(uments when it is in).18 F -.2(vo)
-.4 G -.1(ke).2 G .444(d, and may be reassigned using).1 F(GNU Bash-3.0)
72 768 Q(2004 Jan 28)149.845 E(7)204.835 E 0 Cg EP
72 768 Q(2004 Apr 20)148.735 E(7)203.725 E 0 Cg EP
%%Page: 8 8
%%BeginPageSetup
BP
@@ -1200,7 +1214,7 @@ F F1 -.3(BA)144 619.2 S(SH_ARGV).3 E F0(.)A F1 -.3(BA)108 631.2 S
F F1(${FUNCN)144 727.2 Q(AME[)-.2 E F3 8.951($i + 1)B F1(]})A F0 -.1(wa)
11.451 G 11.451(sc).1 G 11.451(alled. The)-11.451 F 8.951
(corresponding source \214le name is)11.451 F(GNU Bash-3.0)72 768 Q
(2004 Jan 28)149.845 E(8)204.835 E 0 Cg EP
(2004 Apr 20)148.735 E(8)203.725 E 0 Cg EP
%%Page: 9 9
%%BeginPageSetup
BP
@@ -1301,7 +1315,7 @@ F(ariable)-.25 E .351(will not change the current directory)144 711.6 R
5.35(.I)-.65 G(f)-5.35 E F3(DIRST)2.85 E -.495(AC)-.81 G(K).495 E F0 .35
(is unset, it loses its special properties, e)2.6 F -.15(ve)-.25 G 2.85
(ni).15 G(f)-2.85 E(it is subsequently reset.)144 723.6 Q(GNU Bash-3.0)
72 768 Q(2004 Jan 28)149.845 E(9)204.835 E 0 Cg EP
72 768 Q(2004 Apr 20)148.735 E(9)203.725 E 0 Cg EP
%%Page: 10 10
%%BeginPageSetup
BP
@@ -1390,7 +1404,7 @@ R .01(alue to)-.25 F F2(RANDOM)2.51 E/F4 9/Times-Roman@0 SF(.)A F0(If)
4.51 E F2(RANDOM)2.51 E F0(is)2.26 E
(unset, it loses its special properties, e)144 720 Q -.15(ve)-.25 G 2.5
(ni).15 G 2.5(fi)-2.5 G 2.5(ti)-2.5 G 2.5(ss)-2.5 G(ubsequently reset.)
-2.5 E(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(10)199.835 E 0 Cg EP
-2.5 E(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(10)198.725 E 0 Cg EP
%%Page: 11 11
%%BeginPageSetup
BP
@@ -1499,7 +1513,7 @@ me e)-3.118 F(xpan-)-.15 E 3.131(sion. If)144 640.8 R 3.132<618c>3.131 G
(all pre)144 724.8 R .698
(vious lines matching the current line to be remo)-.25 F -.15(ve)-.15 G
3.198(df).15 G .698(rom the history list before that line is)-3.198 F
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(11)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(11)198.725 E 0 Cg EP
%%Page: 12 12
%%BeginPageSetup
BP
@@ -1612,7 +1626,7 @@ E F1(LANG)108 648 Q F0 1.24(Used to determine the locale cate)7.11 F
(rrides the v).15 F .764(alue of)-.25 F F1(LANG)3.264 E F0 .764(and an)
3.264 F 3.264(yo)-.15 G(ther)-3.264 E F1(LC_)3.264 E F0 -.25(va)3.264 G
.764(riable specifying a locale cate-).25 F(gory)144 696 Q(.)-.65 E
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(12)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(12)198.725 E 0 Cg EP
%%Page: 13 13
%%BeginPageSetup
BP
@@ -1716,8 +1730,8 @@ F0 1.225(displays during an e)3.725 F -.15(xe)-.15 G 1.225
E F0 1.226(is replicated multiple)3.476 F(times, as necessary)144 696 Q
2.5(,t)-.65 G 2.5(oi)-2.5 G(ndicate multiple le)-2.5 E -.15(ve)-.25 G
(ls of indirection.).15 E(The def)5 E(ault is `)-.1 E(`)-.74 E F1(+)A F0
-.74('')2.5 G(.).74 E(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(13)
199.835 E 0 Cg EP
-.74('')2.5 G(.).74 E(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(13)
198.725 E 0 Cg EP
%%Page: 14 14
%%BeginPageSetup
BP
@@ -1835,7 +1849,7 @@ G .961(or an)-3.461 F 3.461(yr)-.15 G(equirement)-3.461 E
1.302(An array is created automatically if an)108 728.4 R 3.801(yv)-.15
G 1.301(ariable is assigned to using the syntax)-4.051 F F2(name)3.801 E
F0([)A F2(subscript)A F0(]=)A F2(value)A F0(.)A(GNU Bash-3.0)72 768 Q
(2004 Jan 28)149.845 E(14)199.835 E 0 Cg EP
(2004 Apr 20)148.735 E(14)198.725 E 0 Cg EP
%%Page: 15 15
%%BeginPageSetup
BP
@@ -1987,7 +2001,7 @@ F0(must be of the same type.)2.5 E .582(Brace e)108 705.6 R .582
(does not apply an)2.516 F 2.516(ys)-.15 G .016
(yntactic interpretation to the con-)-2.516 F(te)108 729.6 Q
(xt of the e)-.15 E(xpansion or the te)-.15 E(xt between the braces.)
-.15 E(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(15)199.835 E 0 Cg EP
-.15 E(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(15)198.725 E 0 Cg EP
%%Page: 16 16
%%BeginPageSetup
BP
@@ -2115,7 +2129,7 @@ E .351(able is then e)108 700.8 R .351(xpanded and that v)-.15 F .352
F2(@)A F0 .762(]} described belo)B 4.563 -.65(w. T)-.25 H .763(he e).65
F .763(xclamation point must immediately follo)-.15 F 3.263(wt)-.25 G
.763(he left brace in order to)-3.263 F(GNU Bash-3.0)72 768 Q
(2004 Jan 28)149.845 E(16)199.835 E 0 Cg EP
(2004 Apr 20)148.735 E(16)198.725 E 0 Cg EP
%%Page: 17 17
%%BeginPageSetup
BP
@@ -2238,7 +2252,7 @@ F1(par)145.25 664.8 Q(ameter)-.15 E F0 .607
3.151(,t)C .651(he pattern remo)-3.151 F -.25(va)-.15 G 3.151(lo).25 G
.65(peration is applied to each member of the array in)-3.151 F
(turn, and the e)144 712.8 Q(xpansion is the resultant list.)-.15 E
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(17)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(17)198.725 E 0 Cg EP
%%Page: 18 18
%%BeginPageSetup
BP
@@ -2351,7 +2365,7 @@ F1 -.2(ex)2.666 G(pr).2 E(ession)-.37 E F0 .165
A F0(If)5.878 E F1 -.2(ex)108 705.6 S(pr).2 E(ession)-.37 E F0(is in)
2.74 E -.25(va)-.4 G(lid,).25 E F2(bash)2.5 E F0
(prints a message indicating f)2.5 E(ailure and no substitution occurs.)
-.1 E(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(18)199.835 E 0 Cg EP
-.1 E(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(18)198.725 E 0 Cg EP
%%Page: 19 19
%%BeginPageSetup
BP
@@ -2488,8 +2502,8 @@ R 1.12(NUL character may not occur in a pattern.)3.62 F 3.62(Ab)6.12 G
(The special pattern characters must be quoted if the)5.576 F 3.076(ya)
-.15 G(re)-3.076 E(to be matched literally)108 691.2 Q(.)-.65 E
(The special pattern characters ha)108 708 Q .3 -.15(ve t)-.2 H
(he follo).15 E(wing meanings:)-.25 E(GNU Bash-3.0)72 768 Q(2004 Jan 28)
149.845 E(19)199.835 E 0 Cg EP
(he follo).15 E(wing meanings:)-.25 E(GNU Bash-3.0)72 768 Q(2004 Apr 20)
148.735 E(19)198.725 E 0 Cg EP
%%Page: 20 20
%%BeginPageSetup
BP
@@ -2576,12 +2590,12 @@ F2 -.37(re)3.045 G(dir).37 E(ected)-.37 E F0 .545
(ywhere within a)-.15 F F2 .775(simple command)3.615 F F0(or)4.045 E
(may follo)108 584.4 Q 2.5(wa)-.25 G F2(command)A F0 5(.R).77 G
(edirections are processed in the order the)-5 E 2.5(ya)-.15 G(ppear)
-2.5 E 2.5(,f)-.4 G(rom left to right.)-2.5 E .448(In the follo)108
601.2 R .447(wing descriptions, if the \214le descriptor number is omit\
ted, and the \214rst character of the redirec-)-.25 F .365
(tion operator is)108 613.2 R F1(<)2.865 E F0 2.865(,t)C .366
-2.5 E 2.5(,f)-.4 G(rom left to right.)-2.5 E .284(In the follo)108
601.2 R .283(wing descriptions, if the \214le descriptor number is omit\
ted, and the \214rst character of the redirect-)-.25 F .512
(ion operator is)108 613.2 R F1(<)3.012 E F0 3.012(,t)C .512
(he redirection refers to the standard input \(\214le descriptor 0\).)
-2.865 F .366(If the \214rst character of the)5.366 F
-3.012 F .512(If the \214rst character of the)5.512 F
(redirection operator is)108 625.2 Q F1(>)2.5 E F0 2.5(,t)C
(he redirection refers to the standard output \(\214le descriptor 1\).)
-2.5 E .825(The w)108 642 R .825(ord follo)-.1 F .824
@@ -2599,7 +2613,7 @@ ted, and the \214rst character of the redirec-)-.25 F .365
E F0(dirlist 2)2.5 E F1(>&)A F0(1)A
(directs both standard output and standard error to the \214le)108 728.4
Q F2(dirlist)2.5 E F0 2.5(,w).68 G(hile the command)-2.5 E(GNU Bash-3.0)
72 768 Q(2004 Jan 28)149.845 E(20)199.835 E 0 Cg EP
72 768 Q(2004 Apr 20)148.735 E(20)198.725 E 0 Cg EP
%%Page: 21 21
%%BeginPageSetup
BP
@@ -2658,15 +2672,15 @@ F2(n)A F0(])A F1(>)A F2(wor)A(d)-.37 E F0 .155
(If the redirection operator is)108 508.8 R F1(>)2.655 E F0 2.655(,a)C
.155(nd the)-2.655 F F1(noclob)2.655 E(ber)-.1 E F0 .154(option to the)
2.654 F F1(set)2.654 E F0 -.2(bu)2.654 G .154
(iltin has been enabled, the redirection).2 F .076(will f)108 520.8 R
.076(ail if the \214le whose name results from the e)-.1 F .076
(xpansion of)-.15 F F2(wor)2.576 E(d)-.37 E F0 -.15(ex)2.576 G .076
(ists and is a re).15 F .077(gular \214le.)-.15 F .077(If the redirec-)
5.077 F .548(tion operator is)108 532.8 R F1(>|)3.048 E F0 3.048(,o)C
3.048(rt)-3.048 G .548(he redirection operator is)-3.048 F F1(>)3.047 E
F0 .547(and the)3.047 F F1(noclob)3.047 E(ber)-.1 E F0 .547
(option to the)3.047 F F1(set)3.047 E F0 -.2(bu)3.047 G .547
(iltin command is).2 F(not enabled, the redirection is attempted e)108
(iltin has been enabled, the redirection).2 F .657(will f)108 520.8 R
.657(ail if the \214le whose name results from the e)-.1 F .658
(xpansion of)-.15 F F2(wor)3.158 E(d)-.37 E F0 -.15(ex)3.158 G .658
(ists and is a re).15 F .658(gular \214le.)-.15 F .658(If the redi-)
5.658 F .409(rection operator is)108 532.8 R F1(>|)2.909 E F0 2.909(,o)C
2.909(rt)-2.909 G .409(he redirection operator is)-2.909 F F1(>)2.909 E
F0 .409(and the)2.909 F F1(noclob)2.909 E(ber)-.1 E F0 .409
(option to the)2.909 F F1(set)2.909 E F0 -.2(bu)2.908 G .408
(iltin command).2 F(is not enabled, the redirection is attempted e)108
544.8 Q -.15(ve)-.25 G 2.5(ni).15 G 2.5(ft)-2.5 G(he \214le named by)
-2.5 E F2(wor)2.5 E(d)-.37 E F0 -.15(ex)2.5 G(ists.).15 E F1 -.25(Ap)87
561.6 S(pending Redir).25 E(ected Output)-.18 E F0 .641
@@ -2688,7 +2702,7 @@ Q F0(allo)3.141 E .642(ws both the standard output \(\214le descriptor \
E(There are tw)108 693.6 Q 2.5(of)-.1 G
(ormats for redirecting standard output and standard error:)-2.5 E F1
(&>)144 710.4 Q F2(wor)A(d)-.37 E F0(and)108 722.4 Q(GNU Bash-3.0)72 768
Q(2004 Jan 28)149.845 E(21)199.835 E 0 Cg EP
Q(2004 Apr 20)148.735 E(21)198.725 E 0 Cg EP
%%Page: 22 22
%%BeginPageSetup
BP
@@ -2775,7 +2789,7 @@ E F0(is closed after being duplicated to)2.5 E F2(n)2.5 E F0(.)A
.24 G 2.786(rt)-2.786 G .285
(he standard output \(\214le descriptor 1\) if)-2.786 F F2(n)2.785 E F0
.285(is not speci-)2.785 F(\214ed.)108 705.6 Q(GNU Bash-3.0)72 768 Q
(2004 Jan 28)149.845 E(22)199.835 E 0 Cg EP
(2004 Apr 20)148.735 E(22)198.725 E 0 Cg EP
%%Page: 23 23
%%BeginPageSetup
BP
@@ -2796,32 +2810,34 @@ E 3.174(was)-.25 G .674(tring to be substituted for a w)-3.174 F .674
(ord of a simple command.)-.1 F .394(The shell maintains a list of alia\
ses that may be set and unset with the)108 182.4 R F1(alias)2.894 E F0
(and)2.894 E F1(unalias)2.894 E F0 -.2(bu)2.894 G .394(iltin commands).2
F(\(see)108 194.4 Q/F4 9/Times-Bold@0 SF .763(SHELL B)3.264 F(UIL)-.09 E
.763(TIN COMMANDS)-.828 F F0(belo)3.013 E 3.263(w\). The)-.25 F .763
(\214rst w)3.263 F .763(ord of each command, if unquoted, is check)-.1 F
.763(ed to)-.1 F .633(see if it has an alias.)108 206.4 R .633
(If so, that w)5.633 F .633(ord is replaced by the te)-.1 F .634
(xt of the alias.)-.15 F .634(The alias name and the replace-)5.634 F
.538(ment te)108 218.4 R .538(xt may contain an)-.15 F 3.038(yv)-.15 G
.537(alid shell input, including the)-3.288 F F2(metac)3.417 E(har)-.15
E(acter)-.15 E(s)-.1 E F0 .537(listed abo)3.307 F -.15(ve)-.15 G 3.037
(,w).15 G .537(ith the e)-3.037 F(xception)-.15 E .996
(that the alias name may not contain)108 230.4 R F2(=)3.496 E F0 5.996
(.T)C .996(he \214rst w)-5.996 F .997(ord of the replacement te)-.1 F
.997(xt is tested for aliases, b)-.15 F .997(ut a)-.2 F -.1(wo)108 242.4
S .495(rd that is identical to an alias being e).1 F .495
(xpanded is not e)-.15 F .495(xpanded a second time.)-.15 F .494
(This means that one may)5.494 F(alias)108 254.4 Q F1(ls)3.019 E F0(to)
3.019 E F1 .519(ls \255F)3.019 F F0 3.019(,f)C .519(or instance, and)
-3.019 F F1(bash)3.019 E F0 .52(does not try to recursi)3.019 F -.15(ve)
-.25 G .52(ly e).15 F .52(xpand the replacement te)-.15 F 3.02(xt. If)
-.15 F .52(the last)3.02 F .441(character of the alias v)108 266.4 R
.441(alue is a)-.25 F F2(blank)2.941 E F0 2.941(,t).67 G .441
(hen the ne)-2.941 F .441(xt command w)-.15 F .441(ord follo)-.1 F .441
(wing the alias is also check)-.25 F .441(ed for)-.1 F(alias e)108 278.4
Q(xpansion.)-.15 E(Aliases are created and listed with the)108 295.2 Q
F1(alias)2.5 E F0(command, and remo)2.5 E -.15(ve)-.15 G 2.5(dw).15 G
(ith the)-2.5 E F1(unalias)2.5 E F0(command.)2.5 E .284
F(\(see)108 194.4 Q/F4 9/Times-Bold@0 SF 1.98(SHELL B)4.48 F(UIL)-.09 E
1.98(TIN COMMANDS)-.828 F F0(belo)4.23 E 4.48(w\). The)-.25 F 1.98
(\214rst w)4.48 F 1.979(ord of each simple command, if unquoted, is)-.1
F(check)108 206.4 Q .472(ed to see if it has an alias.)-.1 F .472
(If so, that w)5.472 F .473(ord is replaced by the te)-.1 F .473
(xt of the alias.)-.15 F .473(The characters)5.473 F F1(/)2.973 E F0(,)A
F1($)2.973 E F0(,)A F1(`)2.973 E F0(,)A(and)108 218.4 Q F1(=)3.612 E F0
1.112(and an)3.612 F 3.612(yo)-.15 G 3.612(ft)-3.612 G 1.112(he shell)
-3.612 F F2(metac)3.612 E(har)-.15 E(acter)-.15 E(s)-.1 E F0 1.112
(or quoting characters listed abo)3.612 F 1.411 -.15(ve m)-.15 H 1.111
(ay not appear in an alias).15 F 3.619(name. The)108 230.4 R 1.119
(replacement te)3.619 F 1.119(xt may contain an)-.15 F 3.619(yv)-.15 G
1.119(alid shell input, including shell metacharacters.)-3.869 F 1.12
(The \214rst)6.12 F -.1(wo)108 242.4 S .514(rd of the replacement te).1
F .514(xt is tested for aliases, b)-.15 F .514(ut a w)-.2 F .513
(ord that is identical to an alias being e)-.1 F .513(xpanded is)-.15 F
.295(not e)108 254.4 R .295(xpanded a second time.)-.15 F .296
(This means that one may alias)5.295 F F1(ls)2.796 E F0(to)2.796 E F1
.296(ls \255F)2.796 F F0 2.796(,f)C .296(or instance, and)-2.796 F F1
(bash)2.796 E F0 .296(does not try)2.796 F .543(to recursi)108 266.4 R
-.15(ve)-.25 G .543(ly e).15 F .543(xpand the replacement te)-.15 F
3.043(xt. If)-.15 F .543(the last character of the alias v)3.043 F .542
(alue is a)-.25 F F2(blank)3.042 E F0 3.042(,t).67 G .542(hen the ne)
-3.042 F(xt)-.15 E(command w)108 278.4 Q(ord follo)-.1 E
(wing the alias is also check)-.25 E(ed for alias e)-.1 E(xpansion.)-.15
E(Aliases are created and listed with the)108 295.2 Q F1(alias)2.5 E F0
(command, and remo)2.5 E -.15(ve)-.15 G 2.5(dw).15 G(ith the)-2.5 E F1
(unalias)2.5 E F0(command.)2.5 E .284
(There is no mechanism for using ar)108 312 R .284
(guments in the replacement te)-.18 F 2.784(xt. If)-.15 F(ar)2.784 E
.284(guments are needed, a shell func-)-.18 F(tion should be used \(see)
@@ -2877,13 +2893,13 @@ G 2.816(cuted. Functions).15 F .316(are e)2.816 F -.15(xe)-.15 G .316
F .639(function is e)108 559.2 R -.15(xe)-.15 G .639(cuted, the ar).15 F
.639
(guments to the function become the positional parameters during its e)
-.18 F -.15(xe)-.15 G(cution.).15 E .999(The special parameter)108 571.2
R F1(#)3.498 E F0 .998(is updated to re\215ect the change.)3.498 F .998
(Positional parameter 0 is unchanged.)5.998 F .998(The \214rst)5.998 F
.369(element of the)108 583.2 R F4(FUNCN)2.869 E(AME)-.18 E F0 -.25(va)
2.619 G .37
-.18 F -.15(xe)-.15 G(cution.).15 E .533(The special parameter)108 571.2
R F1(#)3.033 E F0 .532(is updated to re\215ect the change.)3.033 F .532
(Special parameter 0 is unchanged.)5.532 F .532(The \214rst ele-)5.532 F
1.017(ment of the)108 583.2 R F4(FUNCN)3.517 E(AME)-.18 E F0 -.25(va)
3.267 G 1.017
(riable is set to the name of the function while the function is e).25 F
-.15(xe)-.15 G 2.87(cuting. All).15 F 1.285
-.15(xe)-.15 G 3.518(cuting. All).15 F 1.285
(other aspects of the shell e)108 595.2 R -.15(xe)-.15 G 1.285
(cution en).15 F 1.285
(vironment are identical between a function and its caller with the)-.4
@@ -2915,8 +2931,8 @@ F F1 .616(\255o functrace)3.115 F F0 .616
(alues of the positional parameters and the spe-)-.25 F(cial parameter)
108 724.8 Q F1(#)2.5 E F0(are restored to the v)2.5 E(alues the)-.25 E
2.5(yh)-.15 G(ad prior to the function')-2.5 E 2.5(se)-.55 G -.15(xe)
-2.65 G(cution.).15 E(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(23)
199.835 E 0 Cg EP
-2.65 G(cution.).15 E(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(23)
198.725 E 0 Cg EP
%%Page: 24 24
%%BeginPageSetup
BP
@@ -3018,7 +3034,7 @@ H .343(ts inte).15 F .343(ger attrib)-.15 F .343(ute turned on)-.2 F
(xpressions in parentheses are e)-.15 F -.25(va)-.25 G .234
(luated \214rst and may).25 F -.15(ove)108 724.8 S
(rride the precedence rules abo).15 E -.15(ve)-.15 G(.).15 E
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(24)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(24)198.725 E 0 Cg EP
%%Page: 25 25
%%BeginPageSetup
BP
@@ -3128,7 +3144,7 @@ qual to, greater than, or greater than or equal to)144 696 R F3(ar)144
-.65 E F3(Ar)6.01 E(g1)-.37 E F0(and)2.5 E F3(ar)2.83 E(g2)-.37 E F0
(may be positi)2.52 E .3 -.15(ve o)-.25 H 2.5(rn).15 G -2.25 -.15(eg a)
-2.5 H(ti).15 E .3 -.15(ve i)-.25 H(nte).15 E(gers.)-.15 E(GNU Bash-3.0)
72 768 Q(2004 Jan 28)149.845 E(25)199.835 E 0 Cg EP
72 768 Q(2004 Apr 20)148.735 E(25)198.725 E 0 Cg EP
%%Page: 26 26
%%BeginPageSetup
BP
@@ -3244,7 +3260,7 @@ e remainder of the \214rst line speci\214es an interpreter for the pro-)
(COMMAND EXECUTION ENVIR)72 703.2 Q(ONMENT)-.329 E F0(The shell has an)
108 715.2 Q F5 -.2(ex)2.5 G(ecution en).2 E(vir)-.4 E(onment)-.45 E F0
2.5(,w)C(hich consists of the follo)-2.5 E(wing:)-.25 E(GNU Bash-3.0)72
768 Q(2004 Jan 28)149.845 E(26)199.835 E 0 Cg EP
768 Q(2004 Apr 20)148.735 E(26)198.725 E 0 Cg EP
%%Page: 27 27
%%BeginPageSetup
BP
@@ -3354,8 +3370,8 @@ t for)-.4 F F2 -.2(ex)2.643 G(port).2 E F0 .143(to child pro-)3.323 F
.202(parameter assignments, as described abo)108 724.8 R .502 -.15(ve i)
-.15 H(n).15 E/F4 9/Times-Bold@0 SF -.666(PA)2.702 G(RAMETERS).666 E/F5
9/Times-Roman@0 SF(.)A F0 .202(These assignment statements af)4.702 F
.203(fect only the)-.25 F(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E
(27)199.835 E 0 Cg EP
.203(fect only the)-.25 F(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E
(27)198.725 E 0 Cg EP
%%Page: 28 28
%%BeginPageSetup
BP
@@ -3440,14 +3456,14 @@ E F1(diso)2.5 E(wn \255h)-.1 E F0(.)A .166(If the)108 484.8 R F1
(huponexit)2.666 E F0 .166(shell option has been set with)2.666 F F1
(shopt)2.666 E F0(,)A F1(bash)2.666 E F0 .166(sends a)2.666 F F4(SIGHUP)
2.666 E F0 .166(to all jobs when an interacti)2.416 F -.15(ve)-.25 G
(login shell e)108 496.8 Q(xits.)-.15 E .076
(If 0for which a trap has been set, the trap will not be e)108 513.6 R
-.15(xe)-.15 G .077(cuted until the command completes.).15 F(When)5.077
E F1(bash)2.577 E F0(is)2.577 E -.1(wa)108 525.6 S .826
(iting for an asynchronous command via the).1 F F1(wait)3.326 E F0 -.2
(bu)3.326 G .826(iltin, the reception of a signal for which a trap has)
.2 F .369(been set will cause the)108 537.6 R F1(wait)2.869 E F0 -.2(bu)
2.869 G .369(iltin to return immediately with an e).2 F .37
(login shell e)108 496.8 Q(xits.)-.15 E .41
(If 0 for which a trap has been set, the trap will not be e)108 513.6 R
-.15(xe)-.15 G .41(cuted until the command completes.).15 F(When)5.41 E
F1(bash)2.91 E F0 .3(is w)108 525.6 R .3
(aiting for an asynchronous command via the)-.1 F F1(wait)2.8 E F0 -.2
(bu)2.8 G .3(iltin, the reception of a signal for which a trap has).2 F
.369(been set will cause the)108 537.6 R F1(wait)2.869 E F0 -.2(bu)2.869
G .369(iltin to return immediately with an e).2 F .37
(xit status greater than 128, immediately)-.15 F
(after which the trap is e)108 549.6 Q -.15(xe)-.15 G(cuted.).15 E F3
(JOB CONTR)72 566.4 Q(OL)-.329 E F2 -.25(Jo)108 578.4 S 4.568(bc).25 G
@@ -3479,7 +3495,7 @@ iated)108 676.8 R .732(with this job is 25647.)108 688.8 R .733
.87(notion of a)108 729.6 R F2(curr)3.37 E .87(ent terminal pr)-.37 F
.871(ocess gr)-.45 F .871(oup ID)-.45 F F0 5.871(.M)C .871
(embers of this process group \(processes whose process)-5.871 F
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(28)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(28)198.725 E 0 Cg EP
%%Page: 29 29
%%BeginPageSetup
BP
@@ -3606,7 +3622,7 @@ ized by inserting a number of backslash-escaped special characters that\
(\\r)144 700.8 Q F0(carriage return)28.78 E F4(\\s)144 712.8 Q F0
(the name of the shell, the basename of)29.33 E F4($0)2.5 E F0
(\(the portion follo)2.5 E(wing the \214nal slash\))-.25 E(GNU Bash-3.0)
72 768 Q(2004 Jan 28)149.845 E(29)199.835 E 0 Cg EP
72 768 Q(2004 Apr 20)148.735 E(29)198.725 E 0 Cg EP
%%Page: 30 30
%%BeginPageSetup
BP
@@ -3727,8 +3743,8 @@ nd the k)108 652.8 R 1.334 -.15(ey b)-.1 H 1.034(indings and).15 F -.25
-.15(ey)-.1 G .987(-bindings may be changed with an).15 F F2(inputr)
3.497 E(c)-.37 E F0 3.487(\214le. Other)3.797 F .987
(programs that use this library may)3.487 F(add their o)108 717.6 Q
(wn commands and bindings.)-.25 E(GNU Bash-3.0)72 768 Q(2004 Jan 28)
149.845 E(30)199.835 E 0 Cg EP
(wn commands and bindings.)-.25 E(GNU Bash-3.0)72 768 Q(2004 Apr 20)
148.735 E(30)198.725 E 0 Cg EP
%%Page: 31 31
%%BeginPageSetup
BP
@@ -3810,8 +3826,8 @@ pes is a)108 612 Q -.25(va)-.2 G(ilable:).25 E F2(\\a)144 624 Q F0
648 Q F0(delete)27.66 E F2(\\f)144 660 Q F0(form feed)29.89 E F2(\\n)144
672 Q F0(ne)27.66 E(wline)-.25 E F2(\\r)144 684 Q F0(carriage return)
28.78 E F2(\\t)144 696 Q F0(horizontal tab)29.89 E F2(\\v)144 708 Q F0
-.15(ve)28.22 G(rtical tab).15 E(GNU Bash-3.0)72 768 Q(2004 Jan 28)
149.845 E(31)199.835 E 0 Cg EP
-.15(ve)28.22 G(rtical tab).15 E(GNU Bash-3.0)72 768 Q(2004 Apr 20)
148.735 E(31)198.725 E 0 Cg EP
%%Page: 32 32
%%BeginPageSetup
BP
@@ -3910,7 +3926,7 @@ F0 .448(When set to)144 688.8 R F1(On)2.948 E F0 2.948(,m)C(ak)-2.948 E
.449(crolling the input horizontally on a)-2.948 F 1.194(single screen \
line when it becomes longer than the screen width rather than wrapping \
to a ne)144 700.8 R(w)-.25 E(line.)144 712.8 Q(GNU Bash-3.0)72 768 Q
(2004 Jan 28)149.845 E(32)199.835 E 0 Cg EP
(2004 Apr 20)148.735 E(32)198.725 E 0 Cg EP
%%Page: 33 33
%%BeginPageSetup
BP
@@ -4009,7 +4025,7 @@ F0 .463(construct allo)2.963 F .462(ws bindings to be made based on the\
(xt of the test e)-.15 F .477
(xtends to the end of the line; no characters)-.15 F
(are required to isolate it.)144 705.6 Q(GNU Bash-3.0)72 768 Q
(2004 Jan 28)149.845 E(33)199.835 E 0 Cg EP
(2004 Apr 20)148.735 E(33)198.725 E 0 Cg EP
%%Page: 34 34
%%BeginPageSetup
BP
@@ -4117,8 +4133,8 @@ E F0 .911(refers to the current cursor position, and)3.411 F F2(mark)
(db).15 G 3.41(yt)-3.41 G(he)-3.41 E F1(set\255mark)108 724.8 Q F0 2.5
(command. The)2.5 F(te)2.5 E
(xt between the point and mark is referred to as the)-.15 E F2 -.37(re)
2.5 G(gion)-.03 E F0(.)A(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(34)
199.835 E 0 Cg EP
2.5 G(gion)-.03 E F0(.)A(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(34)
198.725 E 0 Cg EP
%%Page: 35 35
%%BeginPageSetup
BP
@@ -4197,8 +4213,8 @@ etween the start of the current)-.1 F(line and the point.)144 688.8 Q
(th an ar).4 F(gument)-.18 E/F3 10/Times-Italic@0 SF(n)3.294 E F0 3.294
(,i).24 G .794(nsert the)-3.294 F F3(n)3.294 E F0 .794(th w)B .794
(ord from the pre)-.1 F .794(vious command \(the w)-.25 F .795
(ords in the)-.1 F(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(35)
199.835 E 0 Cg EP
(ords in the)-.1 F(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(35)
198.725 E 0 Cg EP
%%Page: 36 36
%%BeginPageSetup
BP
@@ -4294,8 +4310,8 @@ G .779(nsert characters lik)-3.279 F(e)-.1 E F2(C\255q)3.278 E F0 3.278
-.1 F .023(ving point o)-.15 F -.15(ve)-.15 G 2.524(rt).15 G .024(hat w)
-2.524 F .024(ord as well.)-.1 F .024(If point)5.024 F
(is at the end of the line, this transposes the last tw)144 700.8 Q 2.5
(ow)-.1 G(ords on the line.)-2.6 E(GNU Bash-3.0)72 768 Q(2004 Jan 28)
149.845 E(36)199.835 E 0 Cg EP
(ow)-.1 G(ords on the line.)-2.6 E(GNU Bash-3.0)72 768 Q(2004 Apr 20)
148.735 E(36)198.725 E 0 Cg EP
%%Page: 37 37
%%BeginPageSetup
BP
@@ -4384,7 +4400,7 @@ F0 -1(Ya)144 676.8 S(nk the top of the kill ring into the b)1 E(uf)-.2 E
(Rotate the kill ring, and yank the ne)144 700.8 Q 2.5(wt)-.25 G 2.5
(op. Only)-2.5 F -.1(wo)2.5 G(rks follo).1 E(wing)-.25 E F1(yank)2.5 E
F0(or)2.5 E F1(yank\255pop)2.5 E F0(.)A(GNU Bash-3.0)72 768 Q
(2004 Jan 28)149.845 E(37)199.835 E 0 Cg EP
(2004 Apr 20)148.735 E(37)198.725 E 0 Cg EP
%%Page: 38 38
%%BeginPageSetup
BP
@@ -4486,7 +4502,7 @@ F0(List the possible completions of the te)144 628.8 Q
.715(ords, shell functions, shell b)-.1 F .715(uiltins, and)-.2 F
(\214nally e)144 724.8 Q -.15(xe)-.15 G
(cutable \214lenames, in that order).15 E(.)-.55 E(GNU Bash-3.0)72 768 Q
(2004 Jan 28)149.845 E(38)199.835 E 0 Cg EP
(2004 Apr 20)148.735 E(38)198.725 E 0 Cg EP
%%Page: 39 39
%%BeginPageSetup
BP
@@ -4582,8 +4598,8 @@ F0 1.095(command enough times to)3.595 F
(he current line a shell comment.)-3.339 F .839(If a numeric ar)5.839 F
(gu-)-.18 E(ment causes the comment character to be remo)144 729.6 Q
-.15(ve)-.15 G(d, the line will be e).15 E -.15(xe)-.15 G
(cuted by the shell.).15 E(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E
(39)199.835 E 0 Cg EP
(cuted by the shell.).15 E(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E
(39)198.725 E 0 Cg EP
%%Page: 40 40
%%BeginPageSetup
BP
@@ -4703,7 +4719,7 @@ F .404(gument is the name of the command whose ar)-.18 F .403
(guments are being completed, the second)-.18 F(ar)108 729.6 Q 1.993
(gument is the w)-.18 F 1.993(ord being completed, and the third ar)-.1
F 1.993(gument is the w)-.18 F 1.993(ord preceding the w)-.1 F 1.994
(ord being)-.1 F(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(40)199.835
(ord being)-.1 F(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(40)198.725
E 0 Cg EP
%%Page: 41 41
%%BeginPageSetup
@@ -4849,7 +4865,7 @@ R 1.485(ws control o)-.25 F -.15(ve)-.15 G 3.986(rw).15 G 1.486
E(OL)-.27 E F0(and)3.736 E F2(HISTIGNORE)108 729.6 Q F0 -.25(va)2.708 G
.458(riables may be set to cause the shell to sa).25 F .757 -.15(ve o)
-.2 H .457(nly a subset of the commands entered.).15 F(The)5.457 E
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(41)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(41)198.725 E 0 Cg EP
%%Page: 42 42
%%BeginPageSetup
BP
@@ -4972,7 +4988,7 @@ SF(^)108 667.4 Q F4(string1)-5 I F5(^)5 I F4(string2)-5 I F5(^)5 I F0
F4(string2)A F0(/')A 2.5('\()-.74 G(see)-2.5 E F1(Modi\214ers)2.5 E F0
(belo)2.5 E(w\).)-.25 E F1(!#)108 698.4 Q F0
(The entire command line typed so f)27.67 E(ar)-.1 E(.)-.55 E
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(42)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(42)198.725 E 0 Cg EP
%%Page: 43 43
%%BeginPageSetup
BP
@@ -5088,7 +5104,7 @@ R -.15(xe)-.15 G 3.332(cutable. When).15 F F1(bash)3.332 E F0 .832
/Times-Roman@0 SF(.)A F0 .981(If the)5.481 F F1(sour)3.481 E(cepath)-.18
E F0 .981(option to the)3.481 F F1(shopt)3.481 E F0 -.2(bu)3.481 G .981
(iltin command is turned of).2 F .981(f, the)-.25 F(GNU Bash-3.0)72 768
Q(2004 Jan 28)149.845 E(43)199.835 E 0 Cg EP
Q(2004 Apr 20)148.735 E(43)198.725 E 0 Cg EP
%%Page: 44 44
%%BeginPageSetup
BP
@@ -5200,7 +5216,7 @@ F2 -.1(ke)2.5 G(yseq)-.2 E F0(Remo)180 650.4 Q .3 -.15(ve a)-.15 H .3
F2 -.1(ke)2.5 G(yseq)-.2 E F0(is entered.)2.5 E(The return v)144 691.2 Q
(alue is 0 unless an unrecognized option is gi)-.25 E -.15(ve)-.25 G 2.5
(no).15 G 2.5(ra)-2.5 G 2.5(ne)-2.5 G(rror occurred.)-2.5 E
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(44)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(44)198.725 E 0 Cg EP
%%Page: 45 45
%%BeginPageSetup
BP
@@ -5336,8 +5352,8 @@ F2(action)2.786 E F0 2.786(][)C F1<ad47>-2.786 E F2(globpat)2.786 E F0
E F2(suf-)2.786 E<8c78>108 712.8 Q F0(])A([)144 724.8 Q F1<ad58>A F2
(\214lterpat)2.5 E F0 2.5(][)C F1<ad46>-2.5 E F2(function)2.5 E F0 2.5
(][)C F1<ad43>-2.5 E F2(command)2.5 E F0(])A F2(name)2.5 E F0([)2.5 E F2
(name ...)A F0(])A(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(45)
199.835 E 0 Cg EP
(name ...)A F0(])A(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(45)
198.725 E 0 Cg EP
%%Page: 46 46
%%BeginPageSetup
BP
@@ -5412,7 +5428,7 @@ Q(en from the \214le speci\214ed by the)-.1 E/F3 9/Times-Bold@0 SF
(HOSTFILE)2.5 E F0(shell v)2.25 E(ariable.)-.25 E F1(job)184 696 Q F0
(Job names, if job control is acti)26.11 E -.15(ve)-.25 G 5(.M).15 G
(ay also be speci\214ed as)-5 E F1<ad6a>2.5 E F0(.)A(GNU Bash-3.0)72 768
Q(2004 Jan 28)149.845 E(46)199.835 E 0 Cg EP
Q(2004 Apr 20)148.735 E(46)198.725 E 0 Cg EP
%%Page: 47 47
%%BeginPageSetup
BP
@@ -5519,7 +5535,7 @@ n is de\214ned are displayed as well.)144 662.4 R(The)6.309 E F1<ad46>
698.4 Q F0(Each)25.3 E F2(name)2.5 E F0(is an array v)2.5 E
(ariable \(see)-.25 E F1(Arrays)2.5 E F0(abo)2.5 E -.15(ve)-.15 G(\).)
.15 E F1<ad66>144 710.4 Q F0(Use function names only)26.97 E(.)-.65 E
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(47)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(47)198.725 E 0 Cg EP
%%Page: 48 48
%%BeginPageSetup
BP
@@ -5639,7 +5655,7 @@ F .659(by def)144 648 R(ault.)-.1 E F1(echo)5.659 E F0 .659
(\\a)144 672 Q F0(alert \(bell\))28.22 E F1(\\b)144 684 Q F0(backspace)
27.66 E F1(\\c)144 696 Q F0(suppress trailing ne)28.78 E(wline)-.25 E F1
(\\e)144 708 Q F0(an escape character)28.78 E(GNU Bash-3.0)72 768 Q
(2004 Jan 28)149.845 E(48)199.835 E 0 Cg EP
(2004 Apr 20)148.735 E(48)198.725 E 0 Cg EP
%%Page: 49 49
%%BeginPageSetup
BP
@@ -5773,8 +5789,8 @@ Q F0(that is not a function.)2.68 E F1(fc)108 688.8 Q F0([)2.5 E F1
(is selected from the his-)3.658 F .882(tory list.)144 724.8 R F2 -.45
(Fi)5.882 G -.1(rs).45 G(t).1 E F0(and)4.062 E F2(last)3.472 E F0 .882
(may be speci\214ed as a string \(to locate the last command be)4.062 F
.881(ginning with)-.15 F(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(49)
199.835 E 0 Cg EP
.881(ginning with)-.15 F(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(49)
198.725 E 0 Cg EP
%%Page: 50 50
%%BeginPageSetup
BP
@@ -5904,7 +5920,7 @@ F0 .399(is silent, the option character found is placed in)2.899 F F4
729.6 R 1.241(gument is not found, and)-.18 F F3(getopts)3.741 E F0
1.241(is not silent, a question mark \()3.741 F F3(?).833 E F0 3.742
(\)i).833 G 3.742(sp)-3.742 G 1.242(laced in)-3.742 F(GNU Bash-3.0)72
768 Q(2004 Jan 28)149.845 E(50)199.835 E 0 Cg EP
768 Q(2004 Apr 20)148.735 E(50)198.725 E 0 Cg EP
%%Page: 51 51
%%BeginPageSetup
BP
@@ -6019,7 +6035,7 @@ E F0 .28
(is supplied as an ar)2.922 F .421(gument to)-.18 F F3<ad64>2.921 E F0
(,)A(or the history e)144 703.2 Q(xpansion supplied as an ar)-.15 E
(gument to)-.18 E F3<ad70>2.5 E F0 -.1(fa)2.5 G(ils.).1 E(GNU Bash-3.0)
72 768 Q(2004 Jan 28)149.845 E(51)199.835 E 0 Cg EP
72 768 Q(2004 Apr 20)148.735 E(51)198.725 E 0 Cg EP
%%Page: 52 52
%%BeginPageSetup
BP
@@ -6146,7 +6162,7 @@ tring which contains three types of objects: plain characters, which ar\
e simply)144 715.2 R 1.859
(copied to standard output, character escape sequences, which are con)
144 727.2 R -.15(ve)-.4 G 1.858(rted and copied to the).15 F
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(52)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(52)198.725 E 0 Cg EP
%%Page: 53 53
%%BeginPageSetup
BP
@@ -6264,8 +6280,8 @@ F2<ad65>144 655.2 Q F0 .373
-.15 E(s)-.1 E F2 -.18(re)180 691.2 S(ad).18 E F0 1.394
(returns after reading)3.894 F F1(nc)3.894 E(har)-.15 E(s)-.1 E F0 1.395
(characters rather than w)3.894 F 1.395(aiting for a complete line of)
-.1 F(input.)180 703.2 Q(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(53)
199.835 E 0 Cg EP
-.1 F(input.)180 703.2 Q(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(53)
198.725 E 0 Cg EP
%%Page: 54 54
%%BeginPageSetup
BP
@@ -6389,7 +6405,7 @@ SF<efef>3.481 E F3 .98(list, or if the command's r)3.481 F .98
.711(This option is on by default for interac-)5.711 F 1.165
(tive shells on systems that support it \(see)184 727.2 R F5 1.164
(JOB CONTROL)3.664 F F3 3.664(above\). Backgr)3.414 F(ound)-.18 E F0
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(54)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(54)198.725 E 0 Cg EP
%%Page: 55 55
%%BeginPageSetup
BP
@@ -6451,7 +6467,7 @@ F2<ad6f>4.631 E F1 2.131(is supplied with no)4.631 F F3(option\255name)
(ent options ar)-.18 F(e)-.18 E 4.411(printed. If)184 726 R F2(+o)4.411
E F1 1.911(is supplied with no)4.411 F F3(option\255name)4.412 E F1
4.412(,as)C 1.912(eries of)-4.412 F F2(set)4.412 E F1 1.912(commands to)
4.412 F F0(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(55)199.835 E 0 Cg
4.412 F F0(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(55)198.725 E 0 Cg
EP
%%Page: 56 56
%%BeginPageSetup
@@ -6573,8 +6589,8 @@ G(f)-2.5 E F3(n)2.76 E F1(is gr)2.58 E(eater than)-.18 E F2($#)2.5 E F1
(olling optional shell behavior)-.18 F 6.523(.W)-.74 G 1.523
(ith no options, or)-7.073 F 2.532(with the)144 722.4 R F2<ad70>5.032 E
F1 2.531(option, a list of all settable options is displayed, with an i\
ndication of)5.032 F F0(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(56)
199.835 E 0 Cg EP
ndication of)5.032 F F0(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(56)
198.725 E 0 Cg EP
%%Page: 57 57
%%BeginPageSetup
BP
@@ -6668,7 +6684,7 @@ F1 1.106(trap r)3.606 F 1.107(eturns a value of 2, and the)-.18 F .871
(outine \(a shell function or a shell script exe-)-.18 F(cuted by the)
220 728.4 Q F2(.)2.5 E F1(or)2.5 E F2(source)2.5 E F1
(builtins\), a call to)2.5 E F2(return)2.5 E F1(is simulated.)2.5 E F0
(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(57)199.835 E 0 Cg EP
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(57)198.725 E 0 Cg EP
%%Page: 58 58
%%BeginPageSetup
BP
@@ -6748,8 +6764,8 @@ F3(mail\214le)4.147 E F2 1.647(has been r)4.147 F(ead')-.18 E 4.147('i)
F2 1.548
(matches \214lenames in a case\255insensitive fashion when performing)
4.048 F(pathname expansion \(see)184 696 Q F1(Pathname Expansion)2.5 E
F2(above\).)2.5 E F0(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(58)
199.835 E 0 Cg EP
F2(above\).)2.5 E F0(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(58)
198.725 E 0 Cg EP
%%Page: 59 59
%%BeginPageSetup
BP
@@ -6835,7 +6851,7 @@ F2 1.401(the expr)3.651 F 1.401(ession is tr)-.18 F 1.401
1.356(the \214rst ar)3.856 F 1.356
(gument is not a valid unary conditional operator)-.18 F 3.855(,t)-.74 G
(he)-3.855 E(expr)180 712.8 Q(ession is false.)-.18 E F0(GNU Bash-3.0)72
768 Q(2004 Jan 28)149.845 E(59)199.835 E 0 Cg EP
768 Q(2004 Apr 20)148.735 E(59)198.725 E 0 Cg EP
%%Page: 60 60
%%BeginPageSetup
BP
@@ -6976,7 +6992,7 @@ E F1 2.515(,e)C .015(ven if)-2.515 F F7 .015(type -t)2.515 F(name)144
.411(option is used,)2.911 F F4(type)2.91 E F1 .41(prints all)2.91 F
.164(of the places that contain an executable named)144 722.4 R F5(name)
2.664 E F1 5.164(.T).35 G .164(his includes aliases and functions,)
-5.164 F F0(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(60)199.835 E 0
-5.164 F F0(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(60)198.725 E 0
Cg EP
%%Page: 61 61
%%BeginPageSetup
@@ -7098,7 +7114,7 @@ E F5(,)A F4(HISTCMD)3.724 E F5(,)A F4(FUNCNAME)144 708 Q F5(,)A F4
.553(operties, even if)-.18 F(they ar)144 720 Q 2.5(es)-.18 G
(ubsequently r)-2.5 E 2.5(eset. The)-.18 F(exit status is tr)2.5 E
(ue unless a)-.08 E F3(name)2.76 E F1(is r)2.85 E(eadonly)-.18 E(.)-1.11
E F0(GNU Bash-3.0)72 768 Q(2004 Jan 28)149.845 E(61)199.835 E 0 Cg EP
E F0(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(61)198.725 E 0 Cg EP
%%Page: 62 62
%%BeginPageSetup
BP
@@ -7182,7 +7198,7 @@ F2 2.5(,B)C(rian Fox and Chet Ramey)-2.5 E F3(Portable Operating System\
(The personal initialization \214le, executed for login shells)144 686.4
Q F3(~/.bashr)109.666 698.4 Q(c)-.18 E F2(The individual per)144 710.4 Q
(-interactive-shell startup \214le)-.18 E F0(GNU Bash-3.0)72 768 Q
(2004 Jan 28)149.845 E(62)199.835 E 0 Cg EP
(2004 Apr 20)148.735 E(62)198.725 E 0 Cg EP
%%Page: 63 63
%%BeginPageSetup
BP
@@ -7249,7 +7265,7 @@ F1(bashbug)108.13 393.6 Q F2 1.316(inserts the \214rst thr)4.296 F 1.316
-.18 F .431(or messages while the con-)-.18 F(str)108 631.2 Q
(uct is being r)-.08 E(ead.)-.18 E
(Array variables may not \(yet\) be exported.)108 648 Q F0(GNU Bash-3.0)
72 768 Q(2004 Jan 28)149.845 E(63)199.835 E 0 Cg EP
72 768 Q(2004 Apr 20)148.735 E(63)198.725 E 0 Cg EP
%%Trailer
end
%%EOF
BIN
View File
Binary file not shown.
+17 -15
View File
@@ -1,6 +1,6 @@
<HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created on January, 28 2004 by texi2html 1.64 -->
<!-- Created on April, 20 2004 by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
@@ -33,10 +33,10 @@ Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
<H1>Bash Reference Manual</H1></P><P>
This text is a brief description of the features that are present in
the Bash shell (version 3.0-beta1, 28 January 2004)..
the Bash shell (version 3.0-beta1, 20 April 2004)..
</P><P>
This is Edition 3.0, last updated 28 January 2004,
This is Edition 3.0, last updated 20 April 2004,
of <CITE>The GNU Bash Reference Manual</CITE>,
for <CODE>Bash</CODE>, Version 3.0-beta1.
</P><P>
@@ -1554,7 +1554,7 @@ function become the positional parameters
during its execution (see section <A HREF="bashref.html#SEC25">3.4.1 Positional Parameters</A>).
The special parameter <SAMP>`#'</SAMP> that expands to the number of
positional parameters is updated to reflect the change.
Positional parameter <CODE>0</CODE> is unchanged.
Special parameter <CODE>0</CODE> is unchanged.
The first element of the <CODE>FUNCNAME</CODE> variable is set to the
name of the function while the function is executing.
All other aspects of the shell execution
@@ -2142,9 +2142,9 @@ if the colon is omitted, the operator tests only for existence.
<DD>If <VAR>parameter</VAR>
is unset or null, the expansion of <VAR>word</VAR>
is assigned to <VAR>parameter</VAR>.
The value of <VAR>parameter</VAR>
is then substituted. Positional parameters and special parameters may
not be assigned to in this way.
The value of <VAR>parameter</VAR> is then substituted.
Positional parameters and special parameters may not be assigned to
in this way.
<P>
<DT><CODE>${<VAR>parameter</VAR>:?<VAR>word</VAR>}</CODE>
@@ -7281,13 +7281,15 @@ the <CODE>alias</CODE> and <CODE>unalias</CODE> builtin commands.
The first word of each simple command, if unquoted, is checked to see
if it has an alias.
If so, that word is replaced by the text of the alias.
The alias name and the replacement text may contain any valid
shell input, including shell metacharacters, with the exception
that the alias name may not contain <SAMP>`='</SAMP>.
The characters <SAMP>`/'</SAMP>, <SAMP>`$'</SAMP>, <SAMP>``'</SAMP>, <SAMP>`='</SAMP> and any of the
shell metacharacters or quoting characters listed above may not appear
in an alias name.
The replacement text may contain any valid
shell input, including shell metacharacters.
The first word of the replacement text is tested for
aliases, but a word that is identical to an alias being expanded
is not expanded a second time. This means that one may alias
<CODE>ls</CODE> to <CODE>"ls -F"</CODE>,
is not expanded a second time.
This means that one may alias <CODE>ls</CODE> to <CODE>"ls -F"</CODE>,
for instance, and Bash does not try to recursively expand the
replacement text. If the last character of the alias value is a
space or tab character, then the next command word following the
@@ -8138,7 +8140,7 @@ Any trap on <CODE>SIGCHLD</CODE> is executed for each child process
that exits.
</P><P>
If an attempt to exit Bash is while jobs are stopped, the
If an attempt to exit Bash is made while jobs are stopped, the
shell prints a message warning that there are stopped jobs.
The <CODE>jobs</CODE> command may then be used to inspect their status.
If a second attempt to exit is made without an intervening command,
@@ -14996,7 +14998,7 @@ to permit their use in free software.
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="bashref.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1>About this document</H1>
This document was generated by <I>Chet Ramey</I> on <I>January, 28 2004</I>
This document was generated by <I>Chet Ramey</I> on <I>April, 20 2004</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
<P></P>
@@ -15158,7 +15160,7 @@ the following structure:
<BR>
<FONT SIZE="-1">
This document was generated
by <I>Chet Ramey</I> on <I>January, 28 2004</I>
by <I>Chet Ramey</I> on <I>April, 20 2004</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
+142 -141
View File
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 4.5 from
/usr/homes/chet/src/bash/src/doc/bashref.texi.
This text is a brief description of the features that are present in
the Bash shell (version 3.0-beta1, 28 January 2004).
the Bash shell (version 3.0-beta1, 20 April 2004).
This is Edition 3.0, last updated 28 January 2004, of `The GNU Bash
This is Edition 3.0, last updated 20 April 2004, of `The GNU Bash
Reference Manual', for `Bash', Version 3.0-beta1.
Copyright (C) 1988-2003 Free Software Foundation, Inc.
@@ -37,9 +37,9 @@ Bash Features
*************
This text is a brief description of the features that are present in
the Bash shell (version 3.0-beta1, 28 January 2004)..
the Bash shell (version 3.0-beta1, 20 April 2004)..
This is Edition 3.0, last updated 28 January 2004, of `The GNU Bash
This is Edition 3.0, last updated 20 April 2004, of `The GNU Bash
Reference Manual', for `Bash', Version 3.0-beta1.
Bash contains features that appear in other popular shells, and some
@@ -975,7 +975,7 @@ terminated by a semicolon, a `&', or a newline.
When a function is executed, the arguments to the function become
the positional parameters during its execution (*note Positional
Parameters::). The special parameter `#' that expands to the number of
positional parameters is updated to reflect the change. Positional
positional parameters is updated to reflect the change. Special
parameter `0' is unchanged. The first element of the `FUNCNAME'
variable is set to the name of the function while the function is
executing. All other aspects of the shell execution environment are
@@ -1351,8 +1351,8 @@ if the colon is omitted, the operator tests only for existence.
`${PARAMETER:=WORD}'
If PARAMETER is unset or null, the expansion of WORD is assigned
to PARAMETER. The value of PARAMETER is then substituted.
Positional parameters and special parameters may not be assigned
to in this way.
Positional parameters and special parameters may not be assigned to
in this way.
`${PARAMETER:?WORD}'
If PARAMETER is null or unset, the expansion of WORD (or a message
@@ -4809,15 +4809,16 @@ builtin commands.
The first word of each simple command, if unquoted, is checked to see
if it has an alias. If so, that word is replaced by the text of the
alias. The alias name and the replacement text may contain any valid
shell input, including shell metacharacters, with the exception that
the alias name may not contain `='. The first word of the replacement
text is tested for aliases, but a word that is identical to an alias
being expanded is not expanded a second time. This means that one may
alias `ls' to `"ls -F"', for instance, and Bash does not try to
recursively expand the replacement text. If the last character of the
alias value is a space or tab character, then the next command word
following the alias is also checked for alias expansion.
alias. The characters `/', `$', ``', `=' and any of the shell
metacharacters or quoting characters listed above may not appear in an
alias name. The replacement text may contain any valid shell input,
including shell metacharacters. The first word of the replacement text
is tested for aliases, but a word that is identical to an alias being
expanded is not expanded a second time. This means that one may alias
`ls' to `"ls -F"', for instance, and Bash does not try to recursively
expand the replacement text. If the last character of the alias value
is a space or tab character, then the next command word following the
alias is also checked for alias expansion.
Aliases are created and listed with the `alias' command, and removed
with the `unalias' command.
@@ -5428,7 +5429,7 @@ output. If the `-b' option to the `set' builtin is enabled, Bash
reports such changes immediately (*note The Set Builtin::). Any trap
on `SIGCHLD' is executed for each child process that exits.
If an attempt to exit Bash is while jobs are stopped, the shell
If an attempt to exit Bash is made while jobs are stopped, the shell
prints a message warning that there are stopped jobs. The `jobs'
command may then be used to inspect their status. If a second attempt
to exit is made without an intervening command, Bash does not print
@@ -9256,129 +9257,129 @@ Concept Index

Tag Table:
Node: Top1371
Node: Introduction3528
Node: What is Bash?3753
Node: What is a shell?4841
Node: Definitions7377
Node: Basic Shell Features10117
Node: Shell Syntax11335
Node: Shell Operation12359
Node: Quoting13644
Node: Escape Character14906
Node: Single Quotes15378
Node: Double Quotes15713
Node: ANSI-C Quoting16726
Node: Locale Translation17669
Node: Comments18552
Node: Shell Commands19157
Node: Simple Commands19918
Node: Pipelines20539
Node: Lists22405
Node: Compound Commands24027
Node: Looping Constructs24799
Node: Conditional Constructs27233
Node: Command Grouping34286
Node: Shell Functions35722
Node: Shell Parameters39987
Node: Positional Parameters41558
Node: Special Parameters42449
Node: Shell Expansions45107
Node: Brace Expansion47027
Node: Tilde Expansion49343
Node: Shell Parameter Expansion51675
Node: Command Substitution58929
Node: Arithmetic Expansion60251
Node: Process Substitution61092
Node: Word Splitting62129
Node: Filename Expansion63581
Node: Pattern Matching65705
Node: Quote Removal69026
Node: Redirections69312
Node: Executing Commands76787
Node: Simple Command Expansion77454
Node: Command Search and Execution79375
Node: Command Execution Environment81372
Node: Environment84134
Node: Exit Status85785
Node: Signals86980
Node: Shell Scripts88935
Node: Shell Builtin Commands91446
Node: Bourne Shell Builtins92876
Node: Bash Builtins109759
Node: The Set Builtin137881
Node: Special Builtins146099
Node: Shell Variables147071
Node: Bourne Shell Variables147507
Node: Bash Variables149484
Node: Bash Features168989
Node: Invoking Bash169871
Node: Bash Startup Files175682
Node: Interactive Shells180552
Node: What is an Interactive Shell?180954
Node: Is this Shell Interactive?181589
Node: Interactive Shell Behavior182395
Node: Bash Conditional Expressions185662
Node: Shell Arithmetic189082
Node: Aliases191822
Node: Arrays194325
Node: The Directory Stack197345
Node: Directory Stack Builtins198051
Node: Printing a Prompt200930
Node: The Restricted Shell203639
Node: Bash POSIX Mode205464
Node: Job Control212110
Node: Job Control Basics212576
Node: Job Control Builtins216856
Node: Job Control Variables221152
Node: Command Line Editing222302
Node: Introduction and Notation223300
Node: Readline Interaction224917
Node: Readline Bare Essentials226103
Node: Readline Movement Commands227883
Node: Readline Killing Commands228839
Node: Readline Arguments230748
Node: Searching231783
Node: Readline Init File233960
Node: Readline Init File Syntax235014
Node: Conditional Init Constructs246658
Node: Sample Init File249182
Node: Bindable Readline Commands252365
Node: Commands For Moving253564
Node: Commands For History254413
Node: Commands For Text257302
Node: Commands For Killing259963
Node: Numeric Arguments262093
Node: Commands For Completion263220
Node: Keyboard Macros266801
Node: Miscellaneous Commands267360
Node: Readline vi Mode272659
Node: Programmable Completion273568
Node: Programmable Completion Builtins279375
Node: Using History Interactively286737
Node: Bash History Facilities287416
Node: Bash History Builtins290106
Node: History Interaction293958
Node: Event Designators296509
Node: Word Designators297513
Node: Modifiers299143
Node: Installing Bash300540
Node: Basic Installation301674
Node: Compilers and Options304359
Node: Compiling For Multiple Architectures305093
Node: Installation Names306750
Node: Specifying the System Type307561
Node: Sharing Defaults308270
Node: Operation Controls308935
Node: Optional Features309886
Node: Reporting Bugs318158
Node: Major Differences From The Bourne Shell319333
Node: Copying This Manual335081
Node: GNU Free Documentation License335335
Node: Builtin Index357728
Node: Reserved Word Index361355
Node: Variable Index362831
Node: Function Index369824
Node: Concept Index374437
Node: Top1367
Node: Introduction3520
Node: What is Bash?3745
Node: What is a shell?4833
Node: Definitions7369
Node: Basic Shell Features10109
Node: Shell Syntax11327
Node: Shell Operation12351
Node: Quoting13636
Node: Escape Character14898
Node: Single Quotes15370
Node: Double Quotes15705
Node: ANSI-C Quoting16718
Node: Locale Translation17661
Node: Comments18544
Node: Shell Commands19149
Node: Simple Commands19910
Node: Pipelines20531
Node: Lists22397
Node: Compound Commands24019
Node: Looping Constructs24791
Node: Conditional Constructs27225
Node: Command Grouping34278
Node: Shell Functions35714
Node: Shell Parameters39976
Node: Positional Parameters41547
Node: Special Parameters42438
Node: Shell Expansions45096
Node: Brace Expansion47016
Node: Tilde Expansion49332
Node: Shell Parameter Expansion51664
Node: Command Substitution58918
Node: Arithmetic Expansion60240
Node: Process Substitution61081
Node: Word Splitting62118
Node: Filename Expansion63570
Node: Pattern Matching65694
Node: Quote Removal69015
Node: Redirections69301
Node: Executing Commands76776
Node: Simple Command Expansion77443
Node: Command Search and Execution79364
Node: Command Execution Environment81361
Node: Environment84123
Node: Exit Status85774
Node: Signals86969
Node: Shell Scripts88924
Node: Shell Builtin Commands91435
Node: Bourne Shell Builtins92865
Node: Bash Builtins109748
Node: The Set Builtin137870
Node: Special Builtins146088
Node: Shell Variables147060
Node: Bourne Shell Variables147496
Node: Bash Variables149473
Node: Bash Features168978
Node: Invoking Bash169860
Node: Bash Startup Files175671
Node: Interactive Shells180541
Node: What is an Interactive Shell?180943
Node: Is this Shell Interactive?181578
Node: Interactive Shell Behavior182384
Node: Bash Conditional Expressions185651
Node: Shell Arithmetic189071
Node: Aliases191811
Node: Arrays194374
Node: The Directory Stack197394
Node: Directory Stack Builtins198100
Node: Printing a Prompt200979
Node: The Restricted Shell203688
Node: Bash POSIX Mode205513
Node: Job Control212159
Node: Job Control Basics212625
Node: Job Control Builtins216910
Node: Job Control Variables221206
Node: Command Line Editing222356
Node: Introduction and Notation223354
Node: Readline Interaction224971
Node: Readline Bare Essentials226157
Node: Readline Movement Commands227937
Node: Readline Killing Commands228893
Node: Readline Arguments230802
Node: Searching231837
Node: Readline Init File234014
Node: Readline Init File Syntax235068
Node: Conditional Init Constructs246712
Node: Sample Init File249236
Node: Bindable Readline Commands252419
Node: Commands For Moving253618
Node: Commands For History254467
Node: Commands For Text257356
Node: Commands For Killing260017
Node: Numeric Arguments262147
Node: Commands For Completion263274
Node: Keyboard Macros266855
Node: Miscellaneous Commands267414
Node: Readline vi Mode272713
Node: Programmable Completion273622
Node: Programmable Completion Builtins279429
Node: Using History Interactively286791
Node: Bash History Facilities287470
Node: Bash History Builtins290160
Node: History Interaction294012
Node: Event Designators296563
Node: Word Designators297567
Node: Modifiers299197
Node: Installing Bash300594
Node: Basic Installation301728
Node: Compilers and Options304413
Node: Compiling For Multiple Architectures305147
Node: Installation Names306804
Node: Specifying the System Type307615
Node: Sharing Defaults308324
Node: Operation Controls308989
Node: Optional Features309940
Node: Reporting Bugs318212
Node: Major Differences From The Bourne Shell319387
Node: Copying This Manual335135
Node: GNU Free Documentation License335389
Node: Builtin Index357782
Node: Reserved Word Index361409
Node: Variable Index362885
Node: Function Index369878
Node: Concept Index374491

End Tag Table
+4 -4
View File
@@ -1,4 +1,4 @@
This is TeX, Version 3.14159 (Web2C 7.3.1) (format=tex 2001.2.12) 28 JAN 2004 15:50
This is TeX, Version 3.14159 (Web2C 7.3.1) (format=tex 2001.2.12) 20 APR 2004 15:26
**/usr/homes/chet/src/bash/src/doc/bashref.texi
(/usr/homes/chet/src/bash/src/doc/bashref.texi (texinfo.tex
Loading texinfo [version 2003-02-03.16]: Basics,
@@ -318,7 +318,7 @@ Underfull \hbox (badness 2753) in paragraph at lines 1742--1745
[107]) (/usr/homes/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9
[108] [109] [110] [111] [112]) Chapter 10 [113] [114] [115] [116] [117]
Underfull \hbox (badness 2772) in paragraph at lines 6598--6602
Underfull \hbox (badness 2772) in paragraph at lines 6600--6604
[]@textrm Enable sup-port for large files (@texttt http://www.sas.com/standard
s/large_
@@ -357,10 +357,10 @@ Overfull \vbox (42.26959pt too high) has occurred while \output is active
Here is how much of TeX's memory you used:
1713 strings out of 13013
23227 string characters out of 97233
52393 words of memory out of 263001
52389 words of memory out of 263001
2577 multiletter control sequences out of 10000+0
31953 words of font info for 111 fonts, out of 400000 for 1000
19 hyphenation exceptions out of 1000
15i,8n,11p,273b,465s stack positions out of 300i,100n,500p,50000b,4000s
Output written on bashref.dvi (154 pages, 579212 bytes).
Output written on bashref.dvi (154 pages, 579284 bytes).
+63 -61
View File
@@ -8,7 +8,7 @@
%DVIPSWebPage: (www.radicaleye.com)
%DVIPSCommandLine: dvips -D 600 -t letter -o bashref.ps bashref.dvi
%DVIPSParameters: dpi=600, compressed
%DVIPSSource: TeX output 2004.01.28:1550
%DVIPSSource: TeX output 2004.04.20:1526
%%BeginProcSet: texc.pro
%!
/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
@@ -2540,7 +2540,7 @@ letter
1 0 bop 150 1318 a Fu(Bash)64 b(Reference)j(Man)-5 b(ual)p
150 1385 3600 34 v 2361 1481 a Ft(Reference)31 b(Do)s(cumen)m(tation)h
(for)e(Bash)2178 1589 y(Edition)f(3.0,)i(for)f Fs(Bash)g
Ft(V)-8 b(ersion)30 b(3.0-b)s(eta1.)3218 1697 y(Jan)m(uary)g(2004)150
Ft(V)-8 b(ersion)30 b(3.0-b)s(eta1.)3333 1697 y(April)e(2004)150
4935 y Fr(Chet)45 b(Ramey)-11 b(,)46 b(Case)g(W)-11 b(estern)46
b(Reserv)l(e)g(Univ)l(ersit)l(y)150 5068 y(Brian)f(F)-11
b(o)l(x,)45 b(F)-11 b(ree)45 b(Soft)l(w)l(are)h(F)-11
@@ -2548,10 +2548,10 @@ b(oundation)p 150 5141 3600 17 v eop
%%Page: 2 2
2 1 bop 150 2889 a Ft(This)34 b(text)i(is)f(a)h(brief)e(description)g
(of)h(the)h(features)g(that)g(are)g(presen)m(t)g(in)e(the)i(Bash)f
(shell)f(\(v)m(ersion)150 2999 y(3.0-b)s(eta1,)f(28)e(Jan)m(uary)f
(2004\).)150 3133 y(This)i(is)g(Edition)f(3.0,)36 b(last)d(up)s(dated)f
(28)i(Jan)m(uary)f(2004,)j(of)d Fq(The)g(GNU)h(Bash)g(Reference)g(Man)m
(ual)p Ft(,)150 3243 y(for)c Fs(Bash)p Ft(,)g(V)-8 b(ersion)30
(shell)f(\(v)m(ersion)150 2999 y(3.0-b)s(eta1,)f(20)e(April)d(2004\).)
150 3133 y(This)k(is)h(Edition)e(3.0,)36 b(last)e(up)s(dated)e(20)j
(April)c(2004,)37 b(of)d Fq(The)f(GNU)h(Bash)g(Reference)g(Man)m(ual)p
Ft(,)h(for)150 3243 y Fs(Bash)p Ft(,)29 b(V)-8 b(ersion)30
b(3.0-b)s(eta1.)150 3377 y(Cop)m(yrigh)m(t)602 3374 y(c)577
3377 y Fp(\015)g Ft(1988-2003)k(F)-8 b(ree)32 b(Soft)m(w)m(are)f(F)-8
b(oundation,)31 b(Inc.)150 3512 y(P)m(ermission)f(is)i(gran)m(ted)h(to)
@@ -3828,21 +3828,21 @@ Fq(list)h Ft(m)m(ust)e(b)s(e)g(terminated)h(b)m(y)g(a)150
b(The)150 2436 y(sp)s(ecial)35 b(parameter)h(`)p Fs(#)p
Ft(')g(that)h(expands)e(to)i(the)f(n)m(um)m(b)s(er)f(of)h(p)s
(ositional)e(parameters)i(is)f(up)s(dated)g(to)150 2545
y(re\015ect)28 b(the)g(c)m(hange.)41 b(P)m(ositional)27
b(parameter)h Fs(0)f Ft(is)f(unc)m(hanged.)40 b(The)27
b(\014rst)g(elemen)m(t)h(of)f(the)h Fs(FUNCNAME)150 2655
y Ft(v)-5 b(ariable)25 b(is)h(set)h(to)h(the)f(name)f(of)h(the)g
(function)e(while)g(the)i(function)e(is)h(executing.)39
b(All)26 b(other)h(asp)s(ects)150 2765 y(of)32 b(the)g(shell)e
(execution)j(en)m(vironmen)m(t)e(are)i(iden)m(tical)d(b)s(et)m(w)m(een)
j(a)f(function)f(and)g(its)h(caller)f(with)g(the)150
2874 y(exception)25 b(that)h(the)f Fs(DEBUG)f Ft(trap)h(b)s(elo)m(w\))g
(is)f(not)i(inherited)c(unless)i(the)h(function)f(has)h(b)s(een)g(giv)m
(en)g(the)150 2984 y Fs(trace)36 b Ft(attribute)g(using)g(the)h
Fs(declare)e Ft(builtin)e(or)k(the)g Fs(-o)30 b(functrace)35
b Ft(option)h(has)h(b)s(een)f(enabled)150 3093 y(with)c(the)h
Fs(set)g Ft(builtin,)e(\(in)h(whic)m(h)g(case)i(all)e(functions)g
(inherit)f(the)j Fs(DEBUG)e Ft(trap\).)49 b(See)34 b(Section)f(4.1)150
y(re\015ect)h(the)f(c)m(hange.)56 b(Sp)s(ecial)33 b(parameter)j
Fs(0)f Ft(is)f(unc)m(hanged.)54 b(The)35 b(\014rst)f(elemen)m(t)i(of)f
(the)g Fs(FUNCNAME)150 2655 y Ft(v)-5 b(ariable)25 b(is)h(set)h(to)h
(the)f(name)f(of)h(the)g(function)e(while)g(the)i(function)e(is)h
(executing.)39 b(All)26 b(other)h(asp)s(ects)150 2765
y(of)32 b(the)g(shell)e(execution)j(en)m(vironmen)m(t)e(are)i(iden)m
(tical)d(b)s(et)m(w)m(een)j(a)f(function)f(and)g(its)h(caller)f(with)g
(the)150 2874 y(exception)25 b(that)h(the)f Fs(DEBUG)f
Ft(trap)h(b)s(elo)m(w\))g(is)f(not)i(inherited)c(unless)i(the)h
(function)f(has)h(b)s(een)g(giv)m(en)g(the)150 2984 y
Fs(trace)36 b Ft(attribute)g(using)g(the)h Fs(declare)e
Ft(builtin)e(or)k(the)g Fs(-o)30 b(functrace)35 b Ft(option)h(has)h(b)s
(een)f(enabled)150 3093 y(with)c(the)h Fs(set)g Ft(builtin,)e(\(in)h
(whic)m(h)g(case)i(all)e(functions)g(inherit)f(the)j
Fs(DEBUG)e Ft(trap\).)49 b(See)34 b(Section)f(4.1)150
3203 y([Bourne)d(Shell)f(Builtins],)f(page)j(33,)g(for)g(the)f
(description)f(of)h(the)h Fs(trap)e Ft(builtin.)275 3354
y(If)37 b(the)g(builtin)d(command)k Fs(return)d Ft(is)i(executed)h(in)f
@@ -7874,24 +7874,26 @@ Ft(and)h Fs(unalias)e Ft(builtin)f(commands.)p eop
72 77 bop 150 -116 a Ft(72)2572 b(Bash)31 b(Reference)g(Man)m(ual)275
299 y(The)e(\014rst)f(w)m(ord)i(of)f(eac)m(h)i(simple)d(command,)i(if)e
(unquoted,)h(is)g(c)m(hec)m(k)m(ed)i(to)g(see)f(if)f(it)g(has)g(an)g
(alias.)150 408 y(If)34 b(so,)i(that)f(w)m(ord)f(is)f(replaced)h(b)m(y)
g(the)h(text)g(of)g(the)f(alias.)52 b(The)34 b(alias)g(name)g(and)g
(the)g(replacemen)m(t)150 518 y(text)g(ma)m(y)f(con)m(tain)g(an)m(y)g
(v)-5 b(alid)31 b(shell)g(input,)h(including)d(shell)i(metac)m
(haracters,)36 b(with)c(the)h(exception)150 628 y(that)i(the)f(alias)f
(name)h(ma)m(y)h(not)g(con)m(tain)f(`)p Fs(=)p Ft('.)52
b(The)34 b(\014rst)f(w)m(ord)h(of)g(the)g(replacemen)m(t)h(text)g(is)e
(tested)150 737 y(for)26 b(aliases,)h(but)f(a)h(w)m(ord)f(that)h(is)f
(iden)m(tical)f(to)i(an)g(alias)e(b)s(eing)g(expanded)h(is)g(not)g
(expanded)g(a)h(second)150 847 y(time.)40 b(This)27 b(means)i(that)g
(one)g(ma)m(y)h(alias)e Fs(ls)g Ft(to)i Fs("ls)f(-F")p
Ft(,)g(for)f(instance,)i(and)e(Bash)h(do)s(es)f(not)h(try)g(to)150
956 y(recursiv)m(ely)j(expand)g(the)h(replacemen)m(t)g(text.)50
b(If)32 b(the)h(last)g(c)m(haracter)h(of)g(the)f(alias)f(v)-5
b(alue)32 b(is)g(a)h(space)150 1066 y(or)f(tab)g(c)m(haracter,)j(then)d
(the)g(next)g(command)g(w)m(ord)g(follo)m(wing)e(the)i(alias)g(is)f
(also)h(c)m(hec)m(k)m(ed)i(for)e(alias)150 1176 y(expansion.)275
1325 y(Aliases)27 b(are)h(created)i(and)d(listed)g(with)g(the)h
(alias.)150 408 y(If)24 b(so,)i(that)g(w)m(ord)e(is)g(replaced)g(b)m(y)
g(the)h(text)h(of)e(the)h(alias.)38 b(The)24 b(c)m(haracters)i(`)p
Fs(/)p Ft(',)h(`)p Fs($)p Ft(',)f(`)p Fs(`)p Ft(',)g(`)p
Fs(=)p Ft(')f(and)f(an)m(y)h(of)150 518 y(the)e(shell)e(metac)m
(haracters)k(or)e(quoting)f(c)m(haracters)i(listed)e(ab)s(o)m(v)m(e)i
(ma)m(y)f(not)g(app)s(ear)f(in)g(an)h(alias)f(name.)150
628 y(The)g(replacemen)m(t)g(text)h(ma)m(y)g(con)m(tain)g(an)m(y)f(v)-5
b(alid)21 b(shell)f(input,)i(including)d(shell)h(metac)m(haracters.)40
b(The)150 737 y(\014rst)35 b(w)m(ord)g(of)h(the)g(replacemen)m(t)h
(text)f(is)f(tested)i(for)e(aliases,)i(but)e(a)h(w)m(ord)g(that)g(is)f
(iden)m(tical)g(to)h(an)150 847 y(alias)30 b(b)s(eing)g(expanded)g(is)g
(not)h(expanded)f(a)h(second)g(time.)42 b(This)29 b(means)i(that)g(one)
g(ma)m(y)h(alias)e Fs(ls)g Ft(to)150 956 y Fs("ls)f(-F")p
Ft(,)36 b(for)f(instance,)h(and)e(Bash)h(do)s(es)g(not)g(try)g(to)g
(recursiv)m(ely)f(expand)g(the)h(replacemen)m(t)h(text.)150
1066 y(If)31 b(the)h(last)g(c)m(haracter)h(of)f(the)g(alias)f(v)-5
b(alue)31 b(is)g(a)h(space)g(or)g(tab)g(c)m(haracter,)i(then)d(the)h
(next)g(command)150 1176 y(w)m(ord)e(follo)m(wing)f(the)h(alias)g(is)f
(also)i(c)m(hec)m(k)m(ed)h(for)e(alias)g(expansion.)275
1325 y(Aliases)d(are)h(created)i(and)d(listed)g(with)g(the)h
Fs(alias)f Ft(command,)h(and)g(remo)m(v)m(ed)h(with)e(the)h
Fs(unalias)150 1434 y Ft(command.)275 1583 y(There)44
b(is)g(no)h(mec)m(hanism)f(for)g(using)g(argumen)m(ts)h(in)e(the)i
@@ -8512,28 +8514,28 @@ Fs(set)f Ft(builtin)e(is)i(enabled,)h(Bash)g(rep)s(orts)f(suc)m(h)h(c)m
(hanges)150 1228 y(immediately)j(\(see)i(Section)f(4.3)h([The)f(Set)h
(Builtin],)d(page)j(50\).)42 b(An)m(y)29 b(trap)g(on)g
Fs(SIGCHLD)f Ft(is)g(executed)150 1338 y(for)i(eac)m(h)i(c)m(hild)c
(pro)s(cess)i(that)h(exits.)275 1474 y(If)e(an)g(attempt)i(to)g(exit)e
(Bash)h(is)f(while)f(jobs)h(are)h(stopp)s(ed,)f(the)h(shell)e(prin)m
(ts)g(a)i(message)h(w)m(arning)150 1583 y(that)f(there)g(are)g(stopp)s
(ed)f(jobs.)40 b(The)30 b Fs(jobs)e Ft(command)i(ma)m(y)g(then)f(b)s(e)
h(used)f(to)h(insp)s(ect)f(their)f(status.)150 1693 y(If)i(a)h(second)g
(attempt)g(to)h(exit)e(is)g(made)g(without)g(an)g(in)m(terv)m(ening)g
(command,)h(Bash)f(do)s(es)h(not)f(prin)m(t)150 1802
y(another)h(w)m(arning,)e(and)h(the)g(stopp)s(ed)g(jobs)g(are)g
(terminated.)150 2063 y Fr(7.2)68 b(Job)45 b(Con)l(trol)h(Builtins)150
2308 y Fs(bg)870 2443 y(bg)h([)p Fj(jobspec)11 b Fs(])630
2578 y Ft(Resume)28 b(the)g(susp)s(ended)d(job)j Fq(jobsp)s(ec)k
Ft(in)27 b(the)h(bac)m(kground,)h(as)f(if)f(it)g(had)g(b)s(een)g
(started)630 2688 y(with)k(`)p Fs(&)p Ft('.)45 b(If)31
b Fq(jobsp)s(ec)37 b Ft(is)31 b(not)h(supplied,)d(the)j(curren)m(t)g
(job)f(is)g(used.)45 b(The)31 b(return)g(status)630 2797
y(is)h(zero)h(unless)e(it)h(is)g(run)f(when)h(job)g(con)m(trol)h(is)f
(not)h(enabled,)g(or,)g(when)f(run)f(with)g(job)630 2907
y(con)m(trol)37 b(enabled,)h(if)e Fq(jobsp)s(ec)42 b
Ft(w)m(as)37 b(not)h(found)d(or)i Fq(jobsp)s(ec)42 b
Ft(sp)s(eci\014es)36 b(a)h(job)g(that)h(w)m(as)630 3017
y(started)31 b(without)e(job)h(con)m(trol.)150 3177 y
Fs(fg)870 3312 y(fg)47 b([)p Fj(jobspec)11 b Fs(])630
(pro)s(cess)i(that)h(exits.)275 1474 y(If)k(an)h(attempt)h(to)g(exit)f
(Bash)h(is)e(made)h(while)e(jobs)i(are)g(stopp)s(ed,)h(the)f(shell)f
(prin)m(ts)f(a)j(message)150 1583 y(w)m(arning)25 b(that)i(there)f(are)
g(stopp)s(ed)g(jobs.)38 b(The)26 b Fs(jobs)f Ft(command)h(ma)m(y)h
(then)e(b)s(e)h(used)f(to)i(insp)s(ect)e(their)150 1693
y(status.)57 b(If)35 b(a)h(second)g(attempt)g(to)h(exit)e(is)g(made)h
(without)e(an)i(in)m(terv)m(ening)f(command,)h(Bash)g(do)s(es)150
1802 y(not)31 b(prin)m(t)e(another)h(w)m(arning,)g(and)f(the)i(stopp)s
(ed)e(jobs)h(are)h(terminated.)150 2063 y Fr(7.2)68 b(Job)45
b(Con)l(trol)h(Builtins)150 2308 y Fs(bg)870 2443 y(bg)h([)p
Fj(jobspec)11 b Fs(])630 2578 y Ft(Resume)28 b(the)g(susp)s(ended)d
(job)j Fq(jobsp)s(ec)k Ft(in)27 b(the)h(bac)m(kground,)h(as)f(if)f(it)g
(had)g(b)s(een)g(started)630 2688 y(with)k(`)p Fs(&)p
Ft('.)45 b(If)31 b Fq(jobsp)s(ec)37 b Ft(is)31 b(not)h(supplied,)d(the)
j(curren)m(t)g(job)f(is)g(used.)45 b(The)31 b(return)g(status)630
2797 y(is)h(zero)h(unless)e(it)h(is)g(run)f(when)h(job)g(con)m(trol)h
(is)f(not)h(enabled,)g(or,)g(when)f(run)f(with)g(job)630
2907 y(con)m(trol)37 b(enabled,)h(if)e Fq(jobsp)s(ec)42
b Ft(w)m(as)37 b(not)h(found)d(or)i Fq(jobsp)s(ec)42
b Ft(sp)s(eci\014es)36 b(a)h(job)g(that)h(w)m(as)630
3017 y(started)31 b(without)e(job)h(con)m(trol.)150 3177
y Fs(fg)870 3312 y(fg)47 b([)p Fj(jobspec)11 b Fs(])630
3448 y Ft(Resume)43 b(the)g(job)g Fq(jobsp)s(ec)48 b
Ft(in)42 b(the)h(foreground)g(and)f(mak)m(e)j(it)d(the)i(curren)m(t)f
(job.)78 b(If)630 3557 y Fq(jobsp)s(ec)41 b Ft(is)36
+15 -9
View File
@@ -1113,7 +1113,7 @@ function become the positional parameters
during its execution (@pxref{Positional Parameters}).
The special parameter @samp{#} that expands to the number of
positional parameters is updated to reflect the change.
Positional parameter @code{0} is unchanged.
Special parameter @code{0} is unchanged.
The first element of the @env{FUNCNAME} variable is set to the
name of the function while the function is executing.
All other aspects of the shell execution
@@ -1545,9 +1545,9 @@ If @var{parameter} is unset or null, the expansion of
If @var{parameter}
is unset or null, the expansion of @var{word}
is assigned to @var{parameter}.
The value of @var{parameter}
is then substituted. Positional parameters and special parameters may
not be assigned to in this way.
The value of @var{parameter} is then substituted.
Positional parameters and special parameters may not be assigned to
in this way.
@item $@{@var{parameter}:?@var{word}@}
If @var{parameter}
@@ -2600,6 +2600,10 @@ facilities (@pxref{Programmable Completion Builtins}).
Many of the builtins have been extended by @sc{posix} or Bash.
Unless otherwise noted, each builtin command documented as accepting
options preceded by @samp{-} accepts @samp{--}
to signify the end of the options.
@node Bourne Shell Builtins
@section Bourne Shell Builtins
@@ -5424,13 +5428,15 @@ the @code{alias} and @code{unalias} builtin commands.
The first word of each simple command, if unquoted, is checked to see
if it has an alias.
If so, that word is replaced by the text of the alias.
The alias name and the replacement text may contain any valid
shell input, including shell metacharacters, with the exception
that the alias name may not contain @samp{=}.
The characters @samp{/}, @samp{$}, @samp{`}, @samp{=} and any of the
shell metacharacters or quoting characters listed above may not appear
in an alias name.
The replacement text may contain any valid
shell input, including shell metacharacters.
The first word of the replacement text is tested for
aliases, but a word that is identical to an alias being expanded
is not expanded a second time. This means that one may alias
@code{ls} to @code{"ls -F"},
is not expanded a second time.
This means that one may alias @code{ls} to @code{"ls -F"},
for instance, and Bash does not try to recursively expand the
replacement text. If the last character of the alias value is a
space or tab character, then the next command word following the
+13 -11
View File
@@ -1113,7 +1113,7 @@ function become the positional parameters
during its execution (@pxref{Positional Parameters}).
The special parameter @samp{#} that expands to the number of
positional parameters is updated to reflect the change.
Positional parameter @code{0} is unchanged.
Special parameter @code{0} is unchanged.
The first element of the @env{FUNCNAME} variable is set to the
name of the function while the function is executing.
All other aspects of the shell execution
@@ -1545,9 +1545,9 @@ If @var{parameter} is unset or null, the expansion of
If @var{parameter}
is unset or null, the expansion of @var{word}
is assigned to @var{parameter}.
The value of @var{parameter}
is then substituted. Positional parameters and special parameters may
not be assigned to in this way.
The value of @var{parameter} is then substituted.
Positional parameters and special parameters may not be assigned to
in this way.
@item $@{@var{parameter}:?@var{word}@}
If @var{parameter}
@@ -5424,13 +5424,15 @@ the @code{alias} and @code{unalias} builtin commands.
The first word of each simple command, if unquoted, is checked to see
if it has an alias.
If so, that word is replaced by the text of the alias.
The alias name and the replacement text may contain any valid
shell input, including shell metacharacters, with the exception
that the alias name may not contain @samp{=}.
The characters @samp{/}, @samp{$}, @samp{`}, @samp{=} and any of the
shell metacharacters or quoting characters listed above may not appear
in an alias name.
The replacement text may contain any valid
shell input, including shell metacharacters.
The first word of the replacement text is tested for
aliases, but a word that is identical to an alias being expanded
is not expanded a second time. This means that one may alias
@code{ls} to @code{"ls -F"},
is not expanded a second time.
This means that one may alias @code{ls} to @code{"ls -F"},
for instance, and Bash does not try to recursively expand the
replacement text. If the last character of the alias value is a
space or tab character, then the next command word following the
@@ -5718,7 +5720,7 @@ The release of Bash, version + patchlevel (e.g., 2.00.0)
@item \w
The current working directory, with @env{$HOME} abbreviated with a tilde.
@item \W
The basename of @env{$PWD}.
The basename of @env{$PWD}, with @env{$HOME} abbreviated with a tilde.
@item \!
The history number of this command.
@item \#
@@ -6106,7 +6108,7 @@ Bash reports such changes immediately (@pxref{The Set Builtin}).
Any trap on @code{SIGCHLD} is executed for each child process
that exits.
If an attempt to exit Bash is while jobs are stopped, the
If an attempt to exit Bash is made while jobs are stopped, the
shell prints a message warning that there are stopped jobs.
The @code{jobs} command may then be used to inspect their status.
If a second attempt to exit is made without an intervening command,
+20 -20
View File
@@ -474,12 +474,12 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
to _l_a_s_t is selected from the history list. _F_i_r_s_t and _l_a_s_t may
be specified as a string (to locate the last command beginning
with that string) or as a number (an index into the history
list, where a negative number is used as an offset from the
current command number). If _l_a_s_t is not specified it is set to
the current command for listing (so that ``fc -l -10'' prints
the last 10 commands) and to _f_i_r_s_t otherwise. If _f_i_r_s_t is not
specified it is set to the previous command for editing and -16
for listing.
list, where a negative number is used as an offset from the cur-
rent command number). If _l_a_s_t is not specified it is set to the
current command for listing (so that ``fc -l -10'' prints the
last 10 commands) and to _f_i_r_s_t otherwise. If _f_i_r_s_t is not spec-
ified it is set to the previous command for editing and -16 for
listing.
The --nn option suppresses the command numbers when listing. The
--rr option reverses the order of the commands. If the --ll option
@@ -766,14 +766,14 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
One line is read from the standard input, or from the file
descriptor _f_d supplied as an argument to the --uu option, and the
first word is assigned to the first _n_a_m_e, the second word to the
second _n_a_m_e, and so on, with leftover words and their
intervening separators assigned to the last _n_a_m_e. If there are
fewer words read from the input stream than names, the remaining
names are assigned empty values. The characters in IIFFSS are used
to split the line into words. The backslash character (\\) may
be used to remove any special meaning for the next character
read and for line continuation. Options, if supplied, have the
following meanings:
second _n_a_m_e, and so on, with leftover words and their interven-
ing separators assigned to the last _n_a_m_e. If there are fewer
words read from the input stream than names, the remaining names
are assigned empty values. The characters in IIFFSS are used to
split the line into words. The backslash character (\\) may be
used to remove any special meaning for the next character read
and for line continuation. Options, if supplied, have the fol-
lowing meanings:
--aa _a_n_a_m_e
The words are assigned to sequential indices of the array
variable _a_n_a_m_e, starting at 0. _a_n_a_m_e is unset before any
@@ -985,8 +985,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
rather than - causes these options to be turned off. The
options can also be specified as arguments to an invocation of
the shell. The current set of options may be found in $$--. The
return status is always true unless an invalid option is
encountered.
return status is always true unless an invalid option is encoun-
tered.
sshhiifftt [_n]
The positional parameters from _n+1 ... are renamed to $$11 ........
@@ -1044,8 +1044,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
formed.
cchheecckkwwiinnssiizzee
If set, bbaasshh checks the window size after each command
and, if necessary, updates the values of LLIINNEESS and
CCOOLLUUMMNNSS.
and, if necessary, updates the values of LLIINNEESS and CCOOLL--
UUMMNNSS.
ccmmddhhiisstt If set, bbaasshh attempts to save all lines of a multiple-
line command in the same history entry. This allows
easy re-editing of multi-line commands.
@@ -1058,8 +1058,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
exit if eexxeecc fails.
eexxppaanndd__aalliiaasseess
If set, aliases are expanded as described above under
AALLIIAASSEESS. This option is enabled by default for
interactive shells.
AALLIIAASSEESS. This option is enabled by default for interac-
tive shells.
eexxttddeebbuugg
If set, behavior intended for use by debuggers is
enabled:
+18 -4
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.18.1
%%CreationDate: Thu Jan 29 16:59:29 2004
%%Creator: groff version 1.19
%%CreationDate: Tue Apr 20 15:26:45 2004
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
@@ -9,13 +9,17 @@
%%+ font Palatino-Roman
%%+ font Palatino-Italic
%%+ font Palatino-Bold
%%DocumentSuppliedResources: procset grops 1.18 1
%%DocumentSuppliedResources: procset grops 1.19 0
%%Pages: 19
%%PageOrder: Ascend
%%DocumentMedia: Default 612 792 0 () ()
%%Orientation: Portrait
%%EndComments
%%BeginDefaults
%%PageMedia: Default
%%EndDefaults
%%BeginProlog
%%BeginResource: procset grops 1.18 1
%%BeginResource: procset grops 1.19 0
/setpacking where{
pop
currentpacking
@@ -116,16 +120,22 @@ TM setmatrix
/Fr{
setrgbcolor fill
}bind def
/setcmykcolor where{
pop
/Fk{
setcmykcolor fill
}bind def
}if
/Fg{
setgray fill
}bind def
/FL/fill load def
/LW/setlinewidth load def
/Cr/setrgbcolor load def
/setcmykcolor where{
pop
/Ck/setcmykcolor load def
}if
/Cg/setgray load def
/RE{
findfont
@@ -168,6 +178,7 @@ newpath
/CNT countdictstack def
userdict begin
/showpage{}def
/setpagedevice{}def
}bind def
/PEND{
clear
@@ -180,6 +191,9 @@ pop
setpacking
}if
%%EndResource
%%BeginFeature: *PageSize Default
<< /PageSize [ 612 792 ] /ImagingBBox null >> setpagedevice
%%EndFeature
%%IncludeResource: font Times-Roman
%%IncludeResource: font Times-Bold
%%IncludeResource: font Times-Italic
+2 -2
View File
@@ -30,8 +30,8 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
+o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at
startup
+o redirecting output using the >, >|, <>, >&, &>, and >> redirec-
tion operators
+o redirecting output using the >, >|, <>, >&, &>, and >> redirect-
ion operators
+o using the eexxeecc builtin command to replace the shell with another
command
+18 -4
View File
@@ -1,15 +1,19 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.18.1
%%CreationDate: Thu Jan 29 16:59:29 2004
%%Creator: groff version 1.19
%%CreationDate: Tue Apr 20 15:26:45 2004
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.18 1
%%DocumentSuppliedResources: procset grops 1.19 0
%%Pages: 1
%%PageOrder: Ascend
%%DocumentMedia: Default 612 792 0 () ()
%%Orientation: Portrait
%%EndComments
%%BeginDefaults
%%PageMedia: Default
%%EndDefaults
%%BeginProlog
%%BeginResource: procset grops 1.18 1
%%BeginResource: procset grops 1.19 0
/setpacking where{
pop
currentpacking
@@ -110,16 +114,22 @@ TM setmatrix
/Fr{
setrgbcolor fill
}bind def
/setcmykcolor where{
pop
/Fk{
setcmykcolor fill
}bind def
}if
/Fg{
setgray fill
}bind def
/FL/fill load def
/LW/setlinewidth load def
/Cr/setrgbcolor load def
/setcmykcolor where{
pop
/Ck/setcmykcolor load def
}if
/Cg/setgray load def
/RE{
findfont
@@ -162,6 +172,7 @@ newpath
/CNT countdictstack def
userdict begin
/showpage{}def
/setpagedevice{}def
}bind def
/PEND{
clear
@@ -174,6 +185,9 @@ pop
setpacking
}if
%%EndResource
%%BeginFeature: *PageSize Default
<< /PageSize [ 612 792 ] /ImagingBBox null >> setpagedevice
%%EndFeature
%%IncludeResource: font Times-Roman
%%IncludeResource: font Times-Bold
grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
+3 -3
View File
@@ -4,7 +4,7 @@ Copyright (C) 1988-2004 Free Software Foundation, Inc.
@set EDITION 3.0
@set VERSION 3.0-beta1
@set UPDATED 28 January 2004
@set UPDATED-MONTH January 2004
@set UPDATED 20 April 2004
@set UPDATED-MONTH April 2004
@set LASTCHANGE Wed Jan 28 15:50:08 EST 2004
@set LASTCHANGE Tue Apr 20 13:54:25 EDT 2004
+1
View File
@@ -476,6 +476,7 @@ stop_pipeline (async, deferred)
}
/* Scan from the last slot backward, looking for the next free one. */
/* XXX - revisit this interactive assumption */
if (interactive)
{
for (i = job_slots; i; i--)
+3 -1
View File
@@ -476,6 +476,7 @@ stop_pipeline (async, deferred)
}
/* Scan from the last slot backward, looking for the next free one. */
/* XXX - revisit this interactive assumption */
if (interactive)
{
for (i = job_slots; i; i--)
@@ -554,6 +555,7 @@ stop_pipeline (async, deferred)
newjob->j_cleanup = (sh_vptrfunc_t *)NULL;
newjob->cleanarg = (PTR_T) NULL;
itrace("stop_pipeline: adding new job %d", i + 1);
jobs[i] = newjob;
if (newjob->state == JDEAD && (newjob->flags & J_FOREGROUND))
setjstatus (i);
@@ -704,6 +706,7 @@ delete_job (job_index, warn_stopped)
if (temp->deferred)
dispose_command (temp->deferred);
itrace("delete_job: deleting job %d", job_index + 1);
free (temp);
}
@@ -1359,7 +1362,6 @@ make_child (command, async_p)
if (setpgid (mypid, pipeline_pgrp) < 0)
sys_error ("child setpgid (%ld to %ld)", (long)mypid, (long)pipeline_pgrp);
itrace("make_child: setpgid (pid = %d, pgrp = %d)", mypid, pipeline_pgrp);
/* By convention (and assumption above), if
pipeline_pgrp == shell_pgrp, we are making a child for
command substitution.
+1 -1
View File
@@ -1441,7 +1441,7 @@ argument is ignored.
Invoke an editor on the current command line, and execute the result as shell
commands.
Bash attempts to invoke
@code{$FCEDIT}, @code{$EDITOR}, and @code{emacs}
@code{$VISUAL}, @code{$EDITOR}, and @code{emacs}
as the editor, in that order.
@end ifset
File diff suppressed because it is too large Load Diff
+3535
View File
File diff suppressed because it is too large Load Diff
+6 -1
View File
@@ -67,6 +67,11 @@ msgstr ""
msgid "%s: missing colon separator"
msgstr ""
#: builtins/alias.def:123
#, c-format
msgid "`%s': invalid alias name"
msgstr ""
#: builtins/bind.def:194
#, c-format
msgid "`%s': invalid keymap name"
@@ -412,7 +417,7 @@ msgstr ""
msgid "%s: history expansion failed"
msgstr ""
#: builtins/jobs.def:102
#: builtins/jobs.def:99
msgid "no other options allowed with `-x'"
msgstr ""
+4174
View File
File diff suppressed because it is too large Load Diff
+5
View File
@@ -92,6 +92,11 @@ msgstr "no closing %c in %s"
msgid "%s: missing colon separator"
msgstr "%s: missing colon separator"
#: builtins/alias.def:123
#, fuzzy, c-format
msgid "`%s': invalid alias name"
msgstr "%s: invalid keymap name"
#: builtins/bind.def:194
#, c-format
msgid "`%s': invalid keymap name"
+5
View File
@@ -89,6 +89,11 @@ msgstr "no closing %c in %s"
msgid "%s: missing colon separator"
msgstr "%s: missing colon separator"
#: builtins/alias.def:123
#, fuzzy, c-format
msgid "`%s': invalid alias name"
msgstr "%s: invalid keymap name"
#: builtins/bind.def:194
#, c-format
msgid "`%s': invalid keymap name"
+19
View File
@@ -2178,7 +2178,18 @@ pos_params (string, start, end, quoted)
t->next = (WORD_LIST *)NULL;
if (string[0] == '*')
#if 0
ret = (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? string_list_dollar_star (quote_list (h)) : string_list (h);
#else
{
if (quoted & Q_DOUBLE_QUOTES)
ret = string_list_dollar_star (quote_list (h));
else if (quoted & Q_HERE_DOCUMENT)
ret = string_list (quote_list (h));
else
ret = string_list (h);
}
#endif
else
ret = string_list ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? quote_list (h) : h);
if (t != params)
@@ -3457,7 +3468,11 @@ list_remove_pattern (list, pattern, patspec, itype, quoted)
l = REVERSE_LIST (new, WORD_LIST *);
if (itype == '*')
#if 0
tword = (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? string_list_dollar_star (l) : string_list (l);
#else
tword = (quoted & Q_DOUBLE_QUOTES) ? string_list_dollar_star (l) : string_list (l);
#endif
else
tword = string_list ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? quote_list (l) : l);
@@ -5835,7 +5850,11 @@ param_expand (string, sindex, quoted, expanded_something,
quote the whole string, including the separators. If IFS
is unset, the parameters are separated by ' '; if $IFS is
null, the parameters are concatenated. */
#if 0
temp = string_list_dollar_star (list);
#else
temp = (quoted & Q_DOUBLE_QUOTES) ? string_list_dollar_star (list) : string_list (list);
#endif
temp1 = quote_string (temp);
free (temp);
temp = temp1;
+475 -98
View File
@@ -210,8 +210,23 @@ static char *extract_dollar_brace_string __P((char *, int *, int, int));
static char *pos_params __P((char *, int, int, int));
static unsigned char *mb_getcharlens __P((char *, int));
static char *remove_upattern __P((char *, char *, int));
#if defined (HANDLE_MULTIBYTE)
# if !defined (HAVE_WCSDUP)
static wchar_t *wcsdup __P((wchar_t *));
# endif
static wchar_t *remove_wpattern __P((wchar_t *, size_t, wchar_t *, int));
#endif
static char *remove_pattern __P((char *, char *, int));
static int match_pattern_char __P((char *, char *));
static int match_upattern __P((char *, char *, int, char **, char **));
#if defined (HANDLE_MULTIBYTE)
static int match_pattern_wchar __P((wchar_t *, wchar_t *));
static int match_wpattern __P((wchar_t *, char **, size_t, wchar_t *, int, char **, char **));
#endif
static int match_pattern __P((char *, char *, int, char **, char **));
static int getpatspec __P((int, char *));
static char *getpattern __P((char *, int, int));
@@ -244,7 +259,8 @@ static intmax_t parameter_brace_expand_length __P((char *));
static char *skiparith __P((char *, int));
static int verify_substring_values __P((char *, char *, int, intmax_t *, intmax_t *));
static int get_var_and_type __P((char *, char *, SHELL_VAR **, char **));
static int get_var_and_type __P((char *, char *, int, SHELL_VAR **, char **));
static char *mb_substring __P((char *, int, int));
static char *parameter_brace_substring __P((char *, char *, char *, int));
static char *pos_params_pat_subst __P((char *, char *, char *, int));
@@ -1168,9 +1184,9 @@ de_backslash (string)
prev_i = i;
ADVANCE_CHAR (string, slen, i);
if (j < prev_i)
do string[j++] = string[prev_i++]; while (prev_i < i);
do string[j++] = string[prev_i++]; while (prev_i < i);
else
j = i;
j = i;
}
string[j] = '\0';
@@ -1562,6 +1578,10 @@ string_list_internal (list, sep)
if (list == 0)
return ((char *)NULL);
/* Short-circuit quickly if we don't need to separate anything. */
if (list->next == 0)
return (savestring (list->word->word));
/* This is nearly always called with either sep[0] == 0 or sep[1] == 0. */
sep_len = STRLEN (sep);
result_size = 0;
@@ -1957,8 +1977,9 @@ do_assignment_internal (string, expand)
SHELL_VAR *entry;
#if defined (ARRAY_VARS)
char *t;
int ni, assign_list = 0;
int ni;
#endif
int assign_list = 0;
offset = assignment (string, 0);
name = savestring (string);
@@ -2001,14 +2022,7 @@ do_assignment_internal (string, expand)
}
if (echo_command_at_execute)
{
#if defined (ARRAY_VARS)
if (assign_list)
fprintf (stderr, "%s%s=(%s)\n", indirection_level_string (), name, value);
else
#endif
fprintf (stderr, "%s%s=%s\n", indirection_level_string (), name, value);
}
xtrace_print_assignment (name, value, assign_list, 1);
#define ASSIGN_RETURN(r) do { FREE (value); free (name); return (r); } while (0)
@@ -2792,17 +2806,17 @@ remove_quoted_nulls (string)
while (i < slen)
{
if (string[i] == CTLESC)
{
{
/* Old code had j++, but we cannot assume that i == j at this
point -- what if a CTLNUL has already been removed from the
string? We don't want to drop the CTLESC or recopy characters
that we've already copied down. */
i++; string[j++] = CTLESC;
if (i == slen)
break;
}
if (i == slen)
break;
}
else if (string[i] == CTLNUL)
i++;
i++;
prev_i = i;
ADVANCE_CHAR (string, slen, i);
@@ -2836,6 +2850,33 @@ word_list_remove_quoted_nulls (list)
/* */
/* **************************************************************** */
#if defined (HANDLE_MULTIBYTE)
#if 0 /* Currently unused */
static unsigned char *
mb_getcharlens (string, len)
char *string;
int len;
{
int i, offset, last;
unsigned char *ret;
char *p;
DECLARE_MBSTATE;
i = offset = 0;
last = 0;
ret = (unsigned char *)xmalloc (len);
memset (ret, 0, len);
while (string[last])
{
ADVANCE_CHAR (string, len, offset);
ret[last] = offset - last;
last = offset;
}
return ret;
}
#endif
#endif
/* Remove the portion of PARAM matched by PATTERN according to OP, where OP
can have one of 4 values:
RP_LONG_LEFT remove longest matching portion at start of PARAM
@@ -2850,7 +2891,7 @@ word_list_remove_quoted_nulls (list)
#define RP_SHORT_RIGHT 4
static char *
remove_pattern (param, pattern, op)
remove_upattern (param, pattern, op)
char *param, *pattern;
int op;
{
@@ -2858,18 +2899,12 @@ remove_pattern (param, pattern, op)
register char *end;
register char *p, *ret, c;
if (param == NULL)
return (param);
if (*param == '\0' || pattern == NULL || *pattern == '\0') /* minor optimization */
return (savestring (param));
len = STRLEN (param);
end = param + len;
switch (op)
{
case RP_LONG_LEFT: /* remove longest match at start */
/* BACKUP_CHAR_P (param, len, p); */
for (p = end; p >= param; p--)
{
c = *p; *p = '\0';
@@ -2879,11 +2914,11 @@ remove_pattern (param, pattern, op)
return (savestring (p));
}
*p = c;
}
break;
case RP_SHORT_LEFT: /* remove shortest match at start */
/* ADVANCE_CHAR_P (p, end - p),p++ */
for (p = param; p <= end; p++)
{
c = *p; *p = '\0';
@@ -2897,7 +2932,6 @@ remove_pattern (param, pattern, op)
break;
case RP_LONG_RIGHT: /* remove longest match at end */
/* ADVANCE_CHAR_P (p, end - p),p++ */
for (p = param; p <= end; p++)
{
if (strmatch (pattern, p, FNMATCH_EXTFLAG) != FNM_NOMATCH)
@@ -2911,7 +2945,6 @@ remove_pattern (param, pattern, op)
break;
case RP_SHORT_RIGHT: /* remove shortest match at end */
/* BACKUP_CHAR_P (param, len, p); */
for (p = end; p >= param; p--)
{
if (strmatch (pattern, p, FNMATCH_EXTFLAG) != FNM_NOMATCH)
@@ -2924,9 +2957,144 @@ remove_pattern (param, pattern, op)
}
break;
}
return (savestring (param)); /* no match, return original string */
}
#if defined (HANDLE_MULTIBYTE)
#if !defined (HAVE_WCSDUP)
static wchar_t *
wcsdup (ws)
wchar_t *ws;
{
wchar_t *ret;
size_t len;
len = wcslen (ws);
ret = xmalloc ((len + 1) * sizeof (wchar_t));
if (ret == 0)
return ret;
return (wcscpy (ret, ws));
}
#endif /* !HAVE_WCSDUP */
static wchar_t *
remove_wpattern (wparam, wstrlen, wpattern, op)
wchar_t *wparam;
size_t wstrlen;
wchar_t *wpattern;
int op;
{
wchar_t wc;
int n, n1;
wchar_t *ret;
switch (op)
{
case RP_LONG_LEFT: /* remove longest match at start */
for (n = wstrlen; n >= 0; n--)
{
wc = wparam[n]; wparam[n] = L'\0';
if (wcsmatch (wpattern, wparam, FNMATCH_EXTFLAG) != FNM_NOMATCH)
{
wparam[n] = wc;
return (wcsdup (wparam + n));
}
wparam[n] = wc;
}
break;
case RP_SHORT_LEFT: /* remove shortest match at start */
for (n = 0; n <= wstrlen; n++)
{
wc = wparam[n]; wparam[n] = L'\0';
if (wcsmatch (wpattern, wparam, FNMATCH_EXTFLAG) != FNM_NOMATCH)
{
wparam[n] = wc;
return (wcsdup (wparam + n));
}
wparam[n] = wc;
}
break;
case RP_LONG_RIGHT: /* remove longest match at end */
for (n = 0; n <= wstrlen; n++)
{
if (wcsmatch (wpattern, wparam + n, FNMATCH_EXTFLAG) != FNM_NOMATCH)
{
wc = wparam[n]; wparam[n] = L'\0';
ret = wcsdup (wparam);
wparam[n] = wc;
return (ret);
}
}
break;
case RP_SHORT_RIGHT: /* remove shortest match at end */
for (n = wstrlen; n >= 0; n--)
{
if (wcsmatch (wpattern, wparam + n, FNMATCH_EXTFLAG) != FNM_NOMATCH)
{
wc = wparam[n]; wparam[n] = L'\0';
ret = wcsdup (wparam);
wparam[n] = wc;
return (ret);
}
}
break;
}
return (wcsdup (wparam)); /* no match, return original string */
}
#endif /* HANDLE_MULTIBYTE */
static char *
remove_pattern (param, pattern, op)
char *param, *pattern;
int op;
{
if (param == NULL)
return (param);
if (*param == '\0' || pattern == NULL || *pattern == '\0') /* minor optimization */
return (savestring (param));
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1)
{
wchar_t *ret, *oret;
size_t n;
wchar_t *wparam, *wpattern;
mbstate_t ps;
char *xret;
n = xdupmbstowcs (&wpattern, NULL, pattern);
if (n == (size_t)-1)
return (remove_upattern (param, pattern, op));
n = xdupmbstowcs (&wparam, NULL, param);
if (n == (size_t)-1)
{
free (wpattern);
return (remove_upattern (param, pattern, op));
}
oret = ret = remove_wpattern (wparam, n, wpattern, op);
free (wparam);
free (wpattern);
n = strlen (param);
xret = xmalloc (n + 1);
memset (&ps, '\0', sizeof (mbstate_t));
n = wcsrtombs (xret, (const wchar_t **)&ret, n, &ps);
xret[n] = '\0'; /* just to make sure */
free (oret);
return xret;
}
else
#endif
return (remove_upattern (param, pattern, op));
}
/* Return 1 of the first character of STRING could match the first
character of pattern PAT. Used to avoid n2 calls to strmatch(). */
static int
@@ -2964,7 +3132,7 @@ match_pattern_char (pat, string)
MATCH_BEG and MATCH_END anchor the match at the beginning and end
of the string, respectively. The longest match is returned. */
static int
match_pattern (string, pat, mtype, sp, ep)
match_upattern (string, pat, mtype, sp, ep)
char *string, *pat;
int mtype;
char **sp, **ep;
@@ -2973,21 +3141,16 @@ match_pattern (string, pat, mtype, sp, ep)
register char *p, *p1;
char *end;
if (string == 0 || *string == 0 || pat == 0 || *pat == 0)
return (0);
len = STRLEN (string);
end = string + len;
switch (mtype)
{
case MATCH_ANY:
/* ADVANCE_CHAR_P (p, end - p),p++ */
for (p = string; p <= end; p++)
{
if (match_pattern_char (pat, p))
{
/* BACKUP_CHAR_P (p, end - p, p1) */
for (p1 = end; p1 >= p; p1--)
{
c = *p1; *p1 = '\0';
@@ -3002,12 +3165,13 @@ match_pattern (string, pat, mtype, sp, ep)
}
}
}
return (0);
case MATCH_BEG:
if (match_pattern_char (pat, string) == 0)
return (0);
/* BACKUP_CHAR_P (string, len, p) */
for (p = end; p >= string; p--)
{
c = *p; *p = '\0';
@@ -3020,23 +3184,180 @@ match_pattern (string, pat, mtype, sp, ep)
}
*p = c;
}
return (0);
case MATCH_END:
/* ADVANCE_CHAR_P(p, end - p), p++ */
for (p = string; p <= end; p++)
if (strmatch (pat, p, FNMATCH_EXTFLAG) == 0)
{
*sp = p;
*ep = end;
return 1;
}
{
if (strmatch (pat, p, FNMATCH_EXTFLAG) == 0)
{
*sp = p;
*ep = end;
return 1;
}
}
return (0);
}
return (0);
}
#if defined (HANDLE_MULTIBYTE)
/* Return 1 of the first character of WSTRING could match the first
character of pattern WPAT. Wide character version. */
static int
match_pattern_wchar (wpat, wstring)
wchar_t *wpat, *wstring;
{
wchar_t wc;
if (*wstring == 0)
return (0);
switch (wc = *wpat++)
{
default:
return (*wstring == wc);
case L'\\':
return (*wstring == *wpat);
case L'?':
return (*wpat == LPAREN ? 1 : (*wstring != L'\0'));
case L'*':
return (1);
case L'+':
case L'!':
case L'@':
return (*wpat == LPAREN ? 1 : (*wstring == wc));
case L'[':
return (*wstring != L'\0');
}
}
/* Match WPAT anywhere in WSTRING and return the match boundaries.
This returns 1 in case of a successful match, 0 otherwise. Wide
character version. */
static int
match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
wchar_t *wstring;
char **indices;
size_t wstrlen;
wchar_t *wpat;
int mtype;
char **sp, **ep;
{
wchar_t wc;
int len;
#if 0
size_t n, n1; /* Apple's gcc seems to miscompile this badly */
#else
int n, n1;
#endif
switch (mtype)
{
case MATCH_ANY:
for (n = 0; n <= wstrlen; n++)
{
if (match_pattern_wchar (wpat, wstring + n))
{
for (n1 = wstrlen; n1 >= n; n1--)
{
wc = wstring[n1]; wstring[n1] = L'\0';
if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG) == 0)
{
wstring[n1] = wc;
*sp = indices[n];
*ep = indices[n1];
return 1;
}
wstring[n1] = wc;
}
}
}
return (0);
case MATCH_BEG:
if (match_pattern_wchar (wpat, wstring) == 0)
return (0);
for (n = wstrlen; n >= 0; n--)
{
wc = wstring[n]; wstring[n] = L'\0';
if (wcsmatch (wpat, wstring, FNMATCH_EXTFLAG) == 0)
{
wstring[n] = wc;
*sp = indices[0];
*ep = indices[n];
return 1;
}
wstring[n] = wc;
}
return (0);
case MATCH_END:
for (n = 0; n <= wstrlen; n++)
{
if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG) == 0)
{
*sp = indices[n];
*ep = indices[wstrlen];
return 1;
}
}
return (0);
}
return (0);
}
#endif /* HANDLE_MULTIBYTE */
static int
match_pattern (string, pat, mtype, sp, ep)
char *string, *pat;
int mtype;
char **sp, **ep;
{
#if defined (HANDLE_MULTIBYTE)
int ret;
size_t n;
wchar_t *wstring, *wpat;
char **indices;
#endif
if (string == 0 || *string == 0 || pat == 0 || *pat == 0)
return (0);
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1)
{
n = xdupmbstowcs (&wpat, NULL, pat);
if (n == (size_t)-1)
return (match_upattern (string, pat, mtype, sp, ep));
n = xdupmbstowcs (&wstring, &indices, string);
if (n == (size_t)-1)
{
free (wpat);
return (match_upattern (string, pat, mtype, sp, ep));
}
ret = match_wpattern (wstring, indices, n, wpat, mtype, sp, ep);
free (wpat);
free (wstring);
free (indices);
return (ret);
}
else
#endif
return (match_upattern (string, pat, mtype, sp, ep));
}
static int
getpatspec (c, value)
int c;
@@ -3203,7 +3524,7 @@ parameter_brace_remove_pattern (varname, value, patstr, rtype, quoted)
this_command_name = varname;
vtype = get_var_and_type (varname, value, &v, &val);
vtype = get_var_and_type (varname, value, quoted, &v, &val);
if (vtype == -1)
return ((char *)NULL);
@@ -4119,7 +4440,12 @@ parameter_brace_expand_word (name, var_is_special, quoted)
if (legal_number (name, &arg_index))
{
tt = get_dollar_var_value (arg_index);
temp = tt ? quote_escapes (tt) : (char *)NULL;
if (tt)
temp = (*tt && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
? quote_string (tt)
: quote_escapes (tt);
else
temp = (char *)NULL;
FREE (tt);
}
else if (var_is_special) /* ${@} */
@@ -4138,7 +4464,9 @@ parameter_brace_expand_word (name, var_is_special, quoted)
{
temp = array_value (name, quoted, &atype);
if (atype == 0 && temp)
temp = quote_escapes (temp);
temp = (*temp && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
? quote_string (temp)
: quote_escapes (temp);
}
#endif
else if (var = find_variable (name))
@@ -4152,7 +4480,9 @@ parameter_brace_expand_word (name, var_is_special, quoted)
#endif
if (temp)
temp = quote_escapes (temp);
temp = (*temp && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
? quote_string (temp)
: quote_escapes (temp);
}
else
temp = (char *)NULL;
@@ -4174,6 +4504,15 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
char *temp, *t;
t = parameter_brace_expand_word (name, var_is_special, quoted);
/* Have to dequote here if necessary */
if (t)
{
temp = (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
? dequote_string (t)
: dequote_escapes (t);
free (t);
t = temp;
}
chk_atstar (t, quoted, quoted_dollar_atp, contains_dollar_at);
if (t == 0)
return (t);
@@ -4224,11 +4563,16 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
if (l)
{
/* The expansion of TEMP returned something. We need to treat things
slightly differently if HASDOL is non-zero. */
temp = string_list (l);
slightly differently if HASDOL is non-zero. If we have "$@", the
individual words have already been quoted. We need to turn them
into a string with the words separated by the first character of
$IFS without any additional quoting, so string_list_dollar_at won't
do the right thing. We use string_list_dollar_star instead. */
temp = (hasdol || l->next) ? string_list_dollar_star (l) : string_list (l);
/* If l->next is not null, we know that TEMP contained "$@", since that
is the only expansion that creates more than one word. */
if ((hasdol && quoted) || l->next)
if (qdollaratp && ((hasdol && quoted) || l->next))
*qdollaratp = 1;
dispose_words (l);
}
@@ -4563,8 +4907,9 @@ verify_substring_values (value, substr, vtype, e1p, e2p)
characters in the value are quoted with CTLESC and takes appropriate
steps. For convenience, *VALP is set to the dequoted VALUE. */
static int
get_var_and_type (varname, value, varp, valp)
get_var_and_type (varname, value, quoted, varp, valp)
char *varname, *value;
int quoted;
SHELL_VAR **varp;
char **valp;
{
@@ -4611,7 +4956,21 @@ get_var_and_type (varname, value, varp, valp)
}
else
#endif
#if 1
{
if (value && vtype == VT_VARIABLE)
{
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
*valp = dequote_string (value);
else
*valp = dequote_escapes (value);
}
else
*valp = value;
}
#else
*valp = (value && vtype == VT_VARIABLE) ? dequote_escapes (value) : value;
#endif
return vtype;
}
@@ -4622,6 +4981,35 @@ get_var_and_type (varname, value, varp, valp)
/* */
/******************************************************/
#if defined (HANDLE_MULTIBYTE)
/* Character-oriented rather than strictly byte-oriented substrings. S and
E, rather being strict indices into STRING, indicate character (possibly
multibyte character) positions that require calculation.
Used by the ${param:offset[:length]} expansion. */
static char *
mb_substring (string, s, e)
char *string;
int s, e;
{
char *tt;
int start, stop, i, slen;
DECLARE_MBSTATE;
start = 0;
slen = STRLEN (string);
i = s;
while (string[start] && i--)
ADVANCE_CHAR (string, slen, start);
stop = start;
i = e - s;
while (string[stop] && i--)
ADVANCE_CHAR (string, slen, stop);
tt = substring (string, start, stop);
return tt;
}
#endif
/* Process a variable substring expansion: ${name:e1[:e2]}. If VARNAME
is `@', use the positional parameters; otherwise, use the value of
VARNAME. If VARNAME is an array variable, use the array elements. */
@@ -4641,7 +5029,7 @@ parameter_brace_substring (varname, value, substr, quoted)
this_command_name = varname;
vtype = get_var_and_type (varname, value, &v, &val);
vtype = get_var_and_type (varname, value, quoted, &v, &val);
if (vtype == -1)
return ((char *)NULL);
@@ -4656,7 +5044,13 @@ parameter_brace_substring (varname, value, substr, quoted)
{
case VT_VARIABLE:
case VT_ARRAYMEMBER:
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1)
tt = mb_substring (val, e1, e2);
else
#endif
tt = substring (val, e1, e2);
if (vtype == VT_VARIABLE)
FREE (val);
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
@@ -4678,8 +5072,8 @@ parameter_brace_substring (varname, value, substr, quoted)
#if defined (ARRAY_VARS)
case VT_ARRAYVAR:
/* We want E2 to be the number of elements desired (arrays can be sparse,
so verify_substring_values just returns the numbers specified and we
rely on array_subrange to understand how to deal with them). */
so verify_substring_values just returns the numbers specified and we
rely on array_subrange to understand how to deal with them). */
tt = array_subrange (array_cell (v), e1, e2, starsub, quoted);
if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) == 0)
{
@@ -4834,7 +5228,7 @@ parameter_brace_patsub (varname, value, patsub, quoted)
this_command_name = varname;
vtype = get_var_and_type (varname, value, &v, &val);
vtype = get_var_and_type (varname, value, quoted, &v, &val);
if (vtype == -1)
return ((char *)NULL);
@@ -5369,7 +5763,16 @@ param_expand (string, sindex, quoted, expanded_something,
last_command_exit_value = EXECUTION_FAILURE;
return (interactive_shell ? &expand_param_error : &expand_param_fatal);
}
#if 1
if (temp1)
temp = (*temp1 && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)))
? quote_string (temp1)
: quote_escapes (temp1);
else
temp = (char *)NULL;
#else
temp = temp1 ? quote_escapes (temp1) : (char *)NULL;
#endif
break;
/* $$ -- pid of the invoking shell. */
@@ -5606,11 +6009,22 @@ comsub:
{
temp = array_reference (array_cell (var), 0);
if (temp)
temp = quote_escapes (temp);
temp = (*temp && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)))
? quote_string (temp)
: quote_escapes (temp);
else if (unbound_vars_is_error)
goto unbound_variable;
}
else
#endif
temp = quote_escapes (value_cell (var));
{
temp = value_cell (var);
temp = (*temp && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)))
? quote_string (temp)
: quote_escapes (temp);
}
free (temp1);
goto return0;
@@ -5618,6 +6032,7 @@ comsub:
temp = (char *)NULL;
unbound_variable:
if (unbound_vars_is_error)
err_unboundvar (temp1);
else
@@ -5747,26 +6162,7 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin
#if HANDLE_MULTIBYTE
if (MB_CUR_MAX > 1 && string[sindex])
{
int i;
mbstate_t state_bak;
size_t mblength;
state_bak = state;
mblength = mbrlen (string + sindex, string_size - sindex, &state);
if (MB_INVALIDCH (mblength))
{
state = state_bak;
mblength = 1;
}
if (mblength < 1)
mblength = 1;
temp = (char *)xmalloc (mblength + 2);
temp[0] = CTLESC;
for (i = 0; i < mblength; i++)
temp[i+1] = string[sindex++];
temp[mblength + 1] = '\0';
goto add_string;
SADD_MBQCHAR_BODY(temp, string, sindex, string_size);
}
else
#endif
@@ -6106,31 +6502,12 @@ add_twochars:
else
{
#if HANDLE_MULTIBYTE
/* XXX - I'd like to use SCOPY_CHAR_I here. */
if (MB_CUR_MAX > 1)
sindex--;
if (MB_CUR_MAX > 1)
{
int i;
mbstate_t state_bak;
size_t mblength;
sindex--;
state_bak = state;
mblength = mbrlen (string + sindex, string_size - sindex, &state);
if (MB_INVALIDCH (mblength))
{
state = state_bak;
mblength = 1;
}
if (mblength < 1)
mblength = 1;
temp = (char *)xmalloc (mblength + 2);
temp[0] = CTLESC;
for (i = 0; i < mblength; i++)
temp[i + 1] = string[sindex++];
temp[mblength + 1] = '\0';
goto add_string;
SADD_MBQCHAR_BODY(temp, string, sindex, string_size);
}
else
#endif
+5 -10
View File
@@ -2022,16 +2022,7 @@ do_assignment_internal (string, expand)
}
if (echo_command_at_execute)
{
#if 0
if (assign_list)
fprintf (stderr, "%s%s=(%s)\n", indirection_level_string (), name, value);
else
fprintf (stderr, "%s%s=%s\n", indirection_level_string (), name, value);
#else
xtrace_print_assignment (name, value, assign_list, 1);
#endif
}
xtrace_print_assignment (name, value, assign_list, 1);
#define ASSIGN_RETURN(r) do { FREE (value); free (name); return (r); } while (0)
@@ -5844,7 +5835,11 @@ param_expand (string, sindex, quoted, expanded_something,
quote the whole string, including the separators. If IFS
is unset, the parameters are separated by ' '; if $IFS is
null, the parameters are concatenated. */
#if 0
temp = string_list_dollar_star (list);
#else
temp = (quoted & Q_DOUBLE_QUOTES) ? string_list_dollar_star (list) : string_list (list);
#endif
temp1 = quote_string (temp);
free (temp);
temp = temp1;
+16 -38
View File
@@ -4,7 +4,7 @@
#
# The bug address depends on the release status of the shell. Versions
# with status `devel', `alpha', `beta', or `rc' mail bug reports to
# chet@po.cwru.edu and, optionally, to bash-testers@po.cwru.edu.
# chet@cwru.edu and, optionally, to bash-testers@cwru.edu.
# Other versions send mail to bug-bash@gnu.org.
#
# Copyright (C) 1996-2004 Free Software Foundation, Inc.
@@ -39,35 +39,19 @@ MACHTYPE="!MACHTYPE!"
PATH=/bin:/usr/bin:/usr/local/bin:$PATH
export PATH
# If the OS supplies a program to make temp files with semi-random names,
# use it.
# Check if TMPDIR is set, default to /tmp
: ${TMPDIR:=/tmp}
rm_tmp1=false
rm_tmp2=false
# if we don't have mktemp or tempfile, we don't want to see error messages
# like `mktemp: not found', so temporarily redirect stderr using {...} while
# trying to run them. this may fail using old versions of the bourne shell
# that run {...} blocks with redirections in subshells; in that case we're
# no worse off than previous versions
{ TEMPFILE1=`mktemp "$TMPDIR/bbug.XXXXXX" 2>/dev/null` ; } 2>/dev/null
if [ -z "$TEMPFILE1" ]; then
{ TEMPFILE1=`tempfile --prefix bbug --mode 600 2>/dev/null`; } 2>/dev/null
fi
if [ -z "$TEMPFILE1" ]; then
TEMPFILE1=$TMPDIR/bbug.$$
rm_tmp1=true
fi
{ TEMPFILE2=`mktemp "$TMPDIR/bbug.XXXXXX" 2>/dev/null`; } 2>/dev/null
if [ -z "$TEMPFILE2" ]; then
{ TEMPFILE2=`tempfile --prefix bbug --mode 600 2>/dev/null`; } 2>/dev/null
fi
if [ -z "$TEMPFILE2" ]; then
TEMPFILE2="$TMPDIR/bbug.$$.x"
rm_tmp2=true
fi
#Securely create a temporary directory for the temporary files
TEMPDIR=$TMPDIR/bbug.$$
(umask 077 && mkdir $TEMPDIR) || {
echo "$0: could not create temporary directory" >&2
exit 1
}
TEMPFILE1=$TEMPDIR/bbug1
TEMPFILE2=$TEMPDIR/bbug2
USAGE="Usage: $0 [--help] [--version] [bug-report-email-address]"
VERSTR="GNU bashbug, version ${RELEASE}.${PATCHLEVEL}-${RELSTATUS}"
@@ -116,10 +100,10 @@ case "$N" in
*) n= c='\c' ;;
esac
BASHTESTERS="bash-testers@po.cwru.edu"
BASHTESTERS="bash-testers@cwru.edu"
case "$RELSTATUS" in
alpha*|beta*|devel*|rc*) BUGBASH=chet@po.cwru.edu ;;
alpha*|beta*|devel*|rc*) BUGBASH=chet@cwru.edu ;;
*) BUGBASH=bug-bash@gnu.org ;;
esac
@@ -166,8 +150,8 @@ fi
: ${USER=${LOGNAME-`whoami`}}
trap 'rm -f "$TEMPFILE1" "$TEMPFILE2"; exit 1' 1 2 3 13 15
trap 'rm -f "$TEMPFILE1" "$TEMPFILE2"' 0
trap 'rm -rf "$TEMPDIR"; exit 1' 1 2 3 13 15
trap 'rm -rf "$TEMPDIR"' 0
UN=
if (uname) >/dev/null 2>&1; then
@@ -187,9 +171,6 @@ fi
INITIAL_SUBJECT='[50 character or so descriptive subject here (for reference)]'
# this is raceable unless (hopefully) we used mktemp(1) or tempfile(1)
$rm_tmp1 && rm -f "$TEMPFILE1"
cat > "$TEMPFILE1" <<EOF
From: ${USER}
To: ${BUGADDR}
@@ -219,9 +200,6 @@ Fix:
fix for the problem, don't include this section.]
EOF
# this is still raceable unless (hopefully) we used mktemp(1) or tempfile(1)
$rm_tmp2 && rm -f "$TEMPFILE2"
cp "$TEMPFILE1" "$TEMPFILE2"
chmod u+w "$TEMPFILE1"
@@ -272,7 +250,7 @@ while [ $edstat -ne 0 ]; do
done
trap 'rm -f "$TEMPFILE1" "$TEMPFILE2"; exit 1' 2 # restore trap on SIGINT
trap 'rm -rf "$TEMPDIR"; exit 1' 2 # restore trap on SIGINT
if cmp -s "$TEMPFILE1" "$TEMPFILE2"
then
+294
View File
@@ -0,0 +1,294 @@
#!/bin/sh -
#
# bashbug - create a bug report and mail it to the bug address
#
# The bug address depends on the release status of the shell. Versions
# with status `devel', `alpha', `beta', or `rc' mail bug reports to
# chet@po.cwru.edu and, optionally, to bash-testers@po.cwru.edu.
# Other versions send mail to bug-bash@gnu.org.
#
# Copyright (C) 1996-2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
#
# configuration section:
# these variables are filled in by the make target in Makefile
#
MACHINE="!MACHINE!"
OS="!OS!"
CC="!CC!"
CFLAGS="!CFLAGS!"
RELEASE="!RELEASE!"
PATCHLEVEL="!PATCHLEVEL!"
RELSTATUS="!RELSTATUS!"
MACHTYPE="!MACHTYPE!"
PATH=/bin:/usr/bin:/usr/local/bin:$PATH
export PATH
# If the OS supplies a program to make temp files with semi-random names,
# use it.
: ${TMPDIR:=/tmp}
rm_tmp1=false
rm_tmp2=false
# if we don't have mktemp or tempfile, we don't want to see error messages
# like `mktemp: not found', so temporarily redirect stderr using {...} while
# trying to run them. this may fail using old versions of the bourne shell
# that run {...} blocks with redirections in subshells; in that case we're
# no worse off than previous versions
{ TEMPFILE1=`mktemp "$TMPDIR/bbug.XXXXXX" 2>/dev/null` ; } 2>/dev/null
if [ -z "$TEMPFILE1" ]; then
{ TEMPFILE1=`tempfile --prefix bbug --mode 600 2>/dev/null`; } 2>/dev/null
fi
if [ -z "$TEMPFILE1" ]; then
TEMPFILE1=$TMPDIR/bbug.$$
rm_tmp1=true
fi
{ TEMPFILE2=`mktemp "$TMPDIR/bbug.XXXXXX" 2>/dev/null`; } 2>/dev/null
if [ -z "$TEMPFILE2" ]; then
{ TEMPFILE2=`tempfile --prefix bbug --mode 600 2>/dev/null`; } 2>/dev/null
fi
if [ -z "$TEMPFILE2" ]; then
TEMPFILE2="$TMPDIR/bbug.$$.x"
rm_tmp2=true
fi
USAGE="Usage: $0 [--help] [--version] [bug-report-email-address]"
VERSTR="GNU bashbug, version ${RELEASE}.${PATCHLEVEL}-${RELSTATUS}"
do_help= do_version=
while [ $# -gt 0 ]; do
case "$1" in
--help) shift ; do_help=y ;;
--version) shift ; do_version=y ;;
--) shift ; break ;;
-*) echo "bashbug: ${1}: invalid option" >&2
echo "$USAGE" >& 2
exit 2 ;;
*) break ;;
esac
done
if [ -n "$do_version" ]; then
echo "${VERSTR}"
exit 0
fi
if [ -n "$do_help" ]; then
echo "${VERSTR}"
echo "${USAGE}"
echo
cat << HERE_EOF
Bashbug is used to send mail to the Bash maintainers
for when Bash doesn't behave like you'd like, or expect.
Bashbug will start up your editor (as defined by the shell's
EDITOR environment variable) with a preformatted bug report
template for you to fill in. The report will be mailed to the
bash maintainers by default. See the manual for details.
If you invoke bashbug by accident, just quit your editor without
saving any changes to the template, and no bug report will be sent.
HERE_EOF
exit 0
fi
# Figure out how to echo a string without a trailing newline
N=`echo 'hi there\c'`
case "$N" in
*c) n=-n c= ;;
*) n= c='\c' ;;
esac
BASHTESTERS="bash-testers@po.cwru.edu"
case "$RELSTATUS" in
alpha*|beta*|devel*|rc*) BUGBASH=chet@po.cwru.edu ;;
*) BUGBASH=bug-bash@gnu.org ;;
esac
case "$RELSTATUS" in
alpha*|beta*|devel*|rc*)
echo "$0: This is a testing release. Would you like your bug report"
echo "$0: to be sent to the bash-testers mailing list?"
echo $n "$0: Send to bash-testers? $c"
read ans
case "$ans" in
y*|Y*) BUGBASH="${BUGBASH},${BASHTESTERS}" ;;
esac ;;
esac
BUGADDR="${1-$BUGBASH}"
if [ -z "$DEFEDITOR" ] && [ -z "$EDITOR" ]; then
if [ -x /usr/bin/editor ]; then
DEFEDITOR=editor
elif [ -x /usr/local/bin/ce ]; then
DEFEDITOR=ce
elif [ -x /usr/local/bin/emacs ]; then
DEFEDITOR=emacs
elif [ -x /usr/contrib/bin/emacs ]; then
DEFEDITOR=emacs
elif [ -x /usr/bin/emacs ]; then
DEFEDITOR=emacs
elif [ -x /usr/bin/xemacs ]; then
DEFEDITOR=xemacs
elif [ -x /usr/contrib/bin/jove ]; then
DEFEDITOR=jove
elif [ -x /usr/local/bin/jove ]; then
DEFEDITOR=jove
elif [ -x /usr/bin/vi ]; then
DEFEDITOR=vi
else
echo "$0: No default editor found: attempting to use vi" >&2
DEFEDITOR=vi
fi
fi
: ${EDITOR=$DEFEDITOR}
: ${USER=${LOGNAME-`whoami`}}
trap 'rm -f "$TEMPFILE1" "$TEMPFILE2"; exit 1' 1 2 3 13 15
trap 'rm -f "$TEMPFILE1" "$TEMPFILE2"' 0
UN=
if (uname) >/dev/null 2>&1; then
UN=`uname -a`
fi
if [ -f /usr/lib/sendmail ] ; then
RMAIL="/usr/lib/sendmail"
SMARGS="-i -t"
elif [ -f /usr/sbin/sendmail ] ; then
RMAIL="/usr/sbin/sendmail"
SMARGS="-i -t"
else
RMAIL=rmail
SMARGS="$BUGADDR"
fi
INITIAL_SUBJECT='[50 character or so descriptive subject here (for reference)]'
# this is raceable unless (hopefully) we used mktemp(1) or tempfile(1)
$rm_tmp1 && rm -f "$TEMPFILE1"
cat > "$TEMPFILE1" <<EOF
From: ${USER}
To: ${BUGADDR}
Subject: ${INITIAL_SUBJECT}
Configuration Information [Automatically generated, do not change]:
Machine: $MACHINE
OS: $OS
Compiler: $CC
Compilation CFLAGS: $CFLAGS
uname output: $UN
Machine Type: $MACHTYPE
Bash Version: $RELEASE
Patch Level: $PATCHLEVEL
Release Status: $RELSTATUS
Description:
[Detailed description of the problem, suggestion, or complaint.]
Repeat-By:
[Describe the sequence of events that causes the problem
to occur.]
Fix:
[Description of how to fix the problem. If you don't know a
fix for the problem, don't include this section.]
EOF
# this is still raceable unless (hopefully) we used mktemp(1) or tempfile(1)
$rm_tmp2 && rm -f "$TEMPFILE2"
cp "$TEMPFILE1" "$TEMPFILE2"
chmod u+w "$TEMPFILE1"
trap '' 2 # ignore interrupts while in editor
edstat=1
while [ $edstat -ne 0 ]; do
$EDITOR "$TEMPFILE1"
edstat=$?
if [ $edstat -ne 0 ]; then
echo "$0: editor \`$EDITOR' exited with nonzero status."
echo "$0: Perhaps it was interrupted."
echo "$0: Type \`y' to give up, and lose your bug report;"
echo "$0: type \`n' to re-enter the editor."
echo $n "$0: Do you want to give up? $c"
read ans
case "$ans" in
[Yy]*) exit 1 ;;
esac
continue
fi
# find the subject from the temp file and see if it's been changed
CURR_SUB=`grep '^Subject: ' "$TEMPFILE1" | sed 's|^Subject:[ ]*||' | sed 1q`
case "$CURR_SUB" in
"${INITIAL_SUBJECT}")
echo
echo "$0: You have not changed the subject from the default."
echo "$0: Please use a more descriptive subject header."
echo "$0: Type \`y' to give up, and lose your bug report;"
echo "$0: type \`n' to re-enter the editor."
echo $n "$0: Do you want to give up? $c"
read ans
case "$ans" in
[Yy]*) exit 1 ;;
esac
echo "$0: The editor will be restarted in five seconds."
sleep 5
edstat=1
;;
esac
done
trap 'rm -f "$TEMPFILE1" "$TEMPFILE2"; exit 1' 2 # restore trap on SIGINT
if cmp -s "$TEMPFILE1" "$TEMPFILE2"
then
echo "File not changed, no bug report submitted."
exit
fi
echo $n "Send bug report? [y/n] $c"
read ans
case "$ans" in
[Nn]*) exit 0 ;;
esac
${RMAIL} $SMARGS < "$TEMPFILE1" || {
cat "$TEMPFILE1" >> $HOME/dead.bashbug
echo "$0: mail failed: report saved in $HOME/dead.bashbug" >&2
}
exit 0
+271
View File
@@ -0,0 +1,271 @@
#!/bin/sh -
#
# bashbug - create a bug report and mail it to the bug address
#
# The bug address depends on the release status of the shell. Versions
# with status `devel', `alpha', `beta', or `rc' mail bug reports to
# chet@cwru.edu and, optionally, to bash-testers@cwru.edu.
# Other versions send mail to bug-bash@gnu.org.
#
# Copyright (C) 1996-2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
#
# configuration section:
# these variables are filled in by the make target in Makefile
#
MACHINE="!MACHINE!"
OS="!OS!"
CC="!CC!"
CFLAGS="!CFLAGS!"
RELEASE="!RELEASE!"
PATCHLEVEL="!PATCHLEVEL!"
RELSTATUS="!RELSTATUS!"
MACHTYPE="!MACHTYPE!"
PATH=/bin:/usr/bin:/usr/local/bin:$PATH
export PATH
# Check if TMPDIR is set, default to /tmp
: ${TMPDIR:=/tmp}
#Securely create a temporary directory for the temporary files
TEMPDIR=$TMPDIR/bbug.$$
(umask 077 && mkdir $TEMPDIR) || {
echo "Could not create temporary directory. Exiting!"
exit 1
}
TEMPFILE1=$TEMPDIR/bbug1
TEMPFILE2=$TEMPDIR/bbug2
USAGE="Usage: $0 [--help] [--version] [bug-report-email-address]"
VERSTR="GNU bashbug, version ${RELEASE}.${PATCHLEVEL}-${RELSTATUS}"
do_help= do_version=
while [ $# -gt 0 ]; do
case "$1" in
--help) shift ; do_help=y ;;
--version) shift ; do_version=y ;;
--) shift ; break ;;
-*) echo "bashbug: ${1}: invalid option" >&2
echo "$USAGE" >& 2
exit 2 ;;
*) break ;;
esac
done
if [ -n "$do_version" ]; then
echo "${VERSTR}"
exit 0
fi
if [ -n "$do_help" ]; then
echo "${VERSTR}"
echo "${USAGE}"
echo
cat << HERE_EOF
Bashbug is used to send mail to the Bash maintainers
for when Bash doesn't behave like you'd like, or expect.
Bashbug will start up your editor (as defined by the shell's
EDITOR environment variable) with a preformatted bug report
template for you to fill in. The report will be mailed to the
bash maintainers by default. See the manual for details.
If you invoke bashbug by accident, just quit your editor without
saving any changes to the template, and no bug report will be sent.
HERE_EOF
exit 0
fi
# Figure out how to echo a string without a trailing newline
N=`echo 'hi there\c'`
case "$N" in
*c) n=-n c= ;;
*) n= c='\c' ;;
esac
BASHTESTERS="bash-testers@cwru.edu"
case "$RELSTATUS" in
alpha*|beta*|devel*|rc*) BUGBASH=chet@cwru.edu ;;
*) BUGBASH=bug-bash@gnu.org ;;
esac
case "$RELSTATUS" in
alpha*|beta*|devel*|rc*)
echo "$0: This is a testing release. Would you like your bug report"
echo "$0: to be sent to the bash-testers mailing list?"
echo $n "$0: Send to bash-testers? $c"
read ans
case "$ans" in
y*|Y*) BUGBASH="${BUGBASH},${BASHTESTERS}" ;;
esac ;;
esac
BUGADDR="${1-$BUGBASH}"
if [ -z "$DEFEDITOR" ] && [ -z "$EDITOR" ]; then
if [ -x /usr/bin/editor ]; then
DEFEDITOR=editor
elif [ -x /usr/local/bin/ce ]; then
DEFEDITOR=ce
elif [ -x /usr/local/bin/emacs ]; then
DEFEDITOR=emacs
elif [ -x /usr/contrib/bin/emacs ]; then
DEFEDITOR=emacs
elif [ -x /usr/bin/emacs ]; then
DEFEDITOR=emacs
elif [ -x /usr/bin/xemacs ]; then
DEFEDITOR=xemacs
elif [ -x /usr/contrib/bin/jove ]; then
DEFEDITOR=jove
elif [ -x /usr/local/bin/jove ]; then
DEFEDITOR=jove
elif [ -x /usr/bin/vi ]; then
DEFEDITOR=vi
else
echo "$0: No default editor found: attempting to use vi" >&2
DEFEDITOR=vi
fi
fi
: ${EDITOR=$DEFEDITOR}
: ${USER=${LOGNAME-`whoami`}}
trap 'rm -rf "$TEMPDIR"; exit 1' 1 2 3 13 15
trap 'rm -rf "$TEMPDIR"' 0
UN=
if (uname) >/dev/null 2>&1; then
UN=`uname -a`
fi
if [ -f /usr/lib/sendmail ] ; then
RMAIL="/usr/lib/sendmail"
SMARGS="-i -t"
elif [ -f /usr/sbin/sendmail ] ; then
RMAIL="/usr/sbin/sendmail"
SMARGS="-i -t"
else
RMAIL=rmail
SMARGS="$BUGADDR"
fi
INITIAL_SUBJECT='[50 character or so descriptive subject here (for reference)]'
cat > "$TEMPFILE1" <<EOF
From: ${USER}
To: ${BUGADDR}
Subject: ${INITIAL_SUBJECT}
Configuration Information [Automatically generated, do not change]:
Machine: $MACHINE
OS: $OS
Compiler: $CC
Compilation CFLAGS: $CFLAGS
uname output: $UN
Machine Type: $MACHTYPE
Bash Version: $RELEASE
Patch Level: $PATCHLEVEL
Release Status: $RELSTATUS
Description:
[Detailed description of the problem, suggestion, or complaint.]
Repeat-By:
[Describe the sequence of events that causes the problem
to occur.]
Fix:
[Description of how to fix the problem. If you don't know a
fix for the problem, don't include this section.]
EOF
cp "$TEMPFILE1" "$TEMPFILE2"
chmod u+w "$TEMPFILE1"
trap '' 2 # ignore interrupts while in editor
edstat=1
while [ $edstat -ne 0 ]; do
$EDITOR "$TEMPFILE1"
edstat=$?
if [ $edstat -ne 0 ]; then
echo "$0: editor \`$EDITOR' exited with nonzero status."
echo "$0: Perhaps it was interrupted."
echo "$0: Type \`y' to give up, and lose your bug report;"
echo "$0: type \`n' to re-enter the editor."
echo $n "$0: Do you want to give up? $c"
read ans
case "$ans" in
[Yy]*) exit 1 ;;
esac
continue
fi
# find the subject from the temp file and see if it's been changed
CURR_SUB=`grep '^Subject: ' "$TEMPFILE1" | sed 's|^Subject:[ ]*||' | sed 1q`
case "$CURR_SUB" in
"${INITIAL_SUBJECT}")
echo
echo "$0: You have not changed the subject from the default."
echo "$0: Please use a more descriptive subject header."
echo "$0: Type \`y' to give up, and lose your bug report;"
echo "$0: type \`n' to re-enter the editor."
echo $n "$0: Do you want to give up? $c"
read ans
case "$ans" in
[Yy]*) exit 1 ;;
esac
echo "$0: The editor will be restarted in five seconds."
sleep 5
edstat=1
;;
esac
done
trap 'rm -rf "$TEMPDIR"; exit 1' 2 # restore trap on SIGINT
if cmp -s "$TEMPFILE1" "$TEMPFILE2"
then
echo "File not changed, no bug report submitted."
exit
fi
echo $n "Send bug report? [y/n] $c"
read ans
case "$ans" in
[Nn]*) exit 0 ;;
esac
${RMAIL} $SMARGS < "$TEMPFILE1" || {
cat "$TEMPFILE1" >> $HOME/dead.bashbug
echo "$0: mail failed: report saved in $HOME/dead.bashbug" >&2
}
exit 0
+1 -1
View File
@@ -17,7 +17,7 @@ job 6 returns 0
Waiting for job 7
job 7 returns 0
0
./jobs.tests: line 15: wait: no job control
./jobs.tests: line 15: wait: %1: no such job
./jobs.tests: line 20: fg: no job control
wait-for-pid
wait-errors
+97
View File
@@ -0,0 +1,97 @@
./jobs2.sub: line 9: fg: job 1 started without job control
fg: 1
Waiting for job 0
job 0 returns 0
Waiting for job 1
job 1 returns 0
Waiting for job 2
job 2 returns 0
Waiting for job 3
job 3 returns 0
Waiting for job 4
job 4 returns 0
Waiting for job 5
job 5 returns 0
Waiting for job 6
job 6 returns 0
Waiting for job 7
job 7 returns 0
0
./jobs.tests: line 15: wait: no job control
./jobs.tests: line 20: fg: no job control
wait-for-pid
wait-errors
./jobs.tests: line 33: wait: `1-1': not a pid or valid job spec
./jobs.tests: line 34: wait: `-4': not a pid or valid job spec
wait-for-background-pids
async list wait-for-background-pids
async list wait for child
forked
wait-when-no-children
wait-for-job
./jobs.tests: line 56: wait: %2: no such job
127
async list wait-for-job
forked
fg-bg 1
sleep 5
fg-bg 2
sleep 5
fg-bg 3
sleep 5
fg-bg 4
sleep 5
fg-bg 5
./jobs.tests: line 83: fg: %2: no such job
./jobs.tests: line 84: bg: job 1 already in background
fg-bg 6
./jobs.tests: line 91: fg: -s: invalid option
fg: usage: fg [job_spec]
./jobs.tests: line 92: bg: -s: invalid option
bg: usage: bg [job_spec]
./jobs.tests: line 97: disown: -s: invalid option
disown: usage: disown [-h] [-ar] [jobspec ...]
./jobs.tests: line 101: disown: %1: no such job
./jobs.tests: line 104: disown: %2: no such job
wait-for-non-child
./jobs.tests: line 107: wait: pid 1 is not a child of this shell
127
3 -- 1 2 3 -- 1 - 2 - 3
[1] Running sleep 300 &
[2]- Running sleep 350 &
[3]+ Running sleep 400 &
running jobs:
[1] Running sleep 300 &
[2]- Running sleep 350 &
[3]+ Running sleep 400 &
./jobs.tests: line 123: kill: %4: no such job
./jobs.tests: line 125: jobs: %4: no such job
current job:
[3]+ Running sleep 400 &
previous job:
[2]- Running sleep 350 &
after kill -STOP
running jobs:
[1] Running sleep 300 &
[3]- Running sleep 400 &
stopped jobs:
[2]+ Stopped sleep 350
after disown
[2]+ Stopped sleep 350
[3]- Running sleep 400 &
running jobs:
[3]- Running sleep 400 &
stopped jobs:
[2]+ Stopped sleep 350
after kill -s CONT
running jobs:
[2]+ Running sleep 350 &
[3]- Running sleep 400 &
stopped jobs:
after kill -STOP, backgrounding %3:
[3]+ sleep 400 &
killing...
done
after KILL -STOP, foregrounding %1
sleep 10
done
+1 -1
View File
@@ -11,7 +11,7 @@ ${THIS_SH} ./jobs3.sub
jobs
echo $?
# should be a job-control-not-enabled error
# a no-such-job error, since we can use job control notation without job control
wait %1
# make sure we can't fg a job started when job control was not active
+179
View File
@@ -0,0 +1,179 @@
# test out %+, jobs -p, and $! agreement in a subshell first
${THIS_SH} ./jobs1.sub
# test out fg/bg failure in a subshell
${THIS_SH} ./jobs2.sub
# test out behavior of waiting for background pids -- bug in versions
# before 2.03
${THIS_SH} ./jobs3.sub
jobs
echo $?
# should be a job-control-not-enabled error
wait %1
# make sure we can't fg a job started when job control was not active
sleep 30 &
pid=$!
fg %1
# make sure the killed processes don't cause a message
exec 5>&2
exec 2>/dev/null
kill -n 9 $pid
wait # make sure we reap the processes while stderr is still redirected
exec 2>&5
echo wait-for-pid
sleep 10 &
wait $!
echo wait-errors
wait 1-1
wait -- -4
echo wait-for-background-pids
sleep 5 &
sleep 8 &
wait
echo async list wait-for-background-pids
sleep 5 & sleep 8 &
wait
echo async list wait for child
sleep 5 & echo forked
wait
echo wait-when-no-children
wait
set -m
echo wait-for-job
sleep 5 &
wait %2 # this should be a no-such-job error
echo $?
wait %1
echo async list wait-for-job
sleep 5 & echo forked
wait %1
echo fg-bg 1
sleep 5 &
%1
echo fg-bg 2
sleep 5 &
fg %%
echo fg-bg 3
sleep 5 &
fg %s
echo fg-bg 4
sleep 5 &
fg %?ee
# these next two are error cases
echo fg-bg 5
sleep 15 &
fg %2 # this should be a no-such-job error
bg %1 # this should be a `bg background job?' error
wait
# these may someday mean to start the jobs, but not print the line
# describing the status, but for now they are errors
echo fg-bg 6
sleep 5 &
fg -s %1
bg -s %1
wait
# someday this may mean to disown all stopped jobs, but for now it is
# an error
disown -s
# this is an error -- the job with the pid that is the value of $! is
# retained only until a `wait' is performed
disown %1
# this, however, is an error
disown %2
echo wait-for-non-child
wait 1
echo $?
exit 1 | exit 2 | exit 3
echo $? -- ${PIPESTATUS[@]} -- ${PIPESTATUS[0]} - ${PIPESTATUS[1]} - ${PIPESTATUS[2]}
sleep 300 &
sleep 350 &
sleep 400 &
jobs
echo running jobs:
jobs -r
# should be an error
kill -n 1 %4
# should be an error
jobs %4
echo current job:
jobs %+
echo previous job:
jobs %-
kill -STOP %2
sleep 5 # give time for the shell to get the stop notification
echo after kill -STOP
echo running jobs:
jobs -r
echo stopped jobs:
jobs -s
disown %1
echo after disown
jobs
echo running jobs:
jobs -r
echo stopped jobs:
jobs -s
kill -s CONT %2
echo after kill -s CONT
echo running jobs:
jobs -r
echo stopped jobs:
jobs -s
kill -STOP %3
sleep 5 # give time for the shell to get the stop notification
echo after kill -STOP, backgrounding %3:
bg %3
disown -h %2
# make sure the killed processes don't cause a message
exec 5>&2
exec 2>/dev/null
echo killing...
kill -n 9 %2 %3
wait # make sure we reap the processes while stderr is still redirected
echo done
exec 2>&5
sleep 10 &
kill -STOP %1
sleep 5 # give time for the shell to get the stop notification
echo after KILL -STOP, foregrounding %1
fg %1
echo done