mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-24 14:27:57 +02:00
commit bash-20040923 snapshot
This commit is contained in:
@@ -10112,3 +10112,46 @@ bashline.c
|
||||
directory under certain circumstances: a single instance found in
|
||||
$PATH when `.' is not in $PATH, and multiple instances found in the
|
||||
$PATH, even when `.' is in the $PATH
|
||||
|
||||
9/24
|
||||
----
|
||||
command.h
|
||||
- new word flag: W_ASSIGNRHS, means word is rhs of assignment statement
|
||||
- new word flag: W_NOTILDE, means word is not to be tilde expanded
|
||||
- new word flag (internal): W_ITILDE, means the next character is a
|
||||
tilde that should be expanded
|
||||
|
||||
general.c
|
||||
- new set of tilde suffixes for use when parsing the RHS of an
|
||||
assignment statement and =~ should not be subject to tilde expansion
|
||||
- if ASSIGN_P argument to bash_tilde_expand is 2, use tilde prefixes
|
||||
for parsing RHS of assignment statement
|
||||
|
||||
general.[ch]
|
||||
- new function bash_tilde_find_word, drop-in replacement for
|
||||
tilde_find_word
|
||||
|
||||
subst.c
|
||||
- call bash_tilde_expand with secord argument of 2 when expanding rhs
|
||||
of an assignment statement, so tildes after second and subsequent
|
||||
`=' in an assignment are not expanded
|
||||
- new function, expand_string_assignment, to expand the rhs of an
|
||||
assignment statement
|
||||
- add `~' to EXP_CHAR, the characters that will cause the word
|
||||
expansion functions to be called
|
||||
- move tilde expansion into expand_word_internal instead of many
|
||||
different calls to bash_tilde_expand scattered across different
|
||||
functions. NOTE: This means that double quotes surrounding a
|
||||
{paramOPword} expansion will cause tilde expansion to NOT be
|
||||
performed on `word'. I think this is right, what POSIX specifies,
|
||||
and consistent with the behavior of other characters in the rhs
|
||||
|
||||
execute_cmd.c
|
||||
- take out calls to bash_tilde_expand before calling word expansion
|
||||
functions
|
||||
|
||||
9/26
|
||||
----
|
||||
execute_cmd.c
|
||||
- make sure to call UNBLOCK_CHILD before returning on a pipe creation
|
||||
failure in execute_pipeline
|
||||
|
||||
@@ -10105,3 +10105,47 @@ lib/readline/complete.c
|
||||
- change append_to_match so that a non-zero value for
|
||||
rl_completion_suppress_append will cause no `/' to be appended to a
|
||||
directory name
|
||||
|
||||
bashline.c
|
||||
- experimental change to suppress appending a slash for a completed
|
||||
filename that is found in PATH as well as a directory in the current
|
||||
directory under certain circumstances: a single instance found in
|
||||
$PATH when `.' is not in $PATH, and multiple instances found in the
|
||||
$PATH, even when `.' is in the $PATH
|
||||
|
||||
9/24
|
||||
----
|
||||
command.h
|
||||
- new word flag: W_ASSIGNRHS, means word is rhs of assignment statement
|
||||
- new word flag: W_NOTILDE, means word is not to be tilde expanded
|
||||
- new word flag (internal): W_ITILDE, means the next character is a
|
||||
tilde that should be expanded
|
||||
|
||||
general.c
|
||||
- new set of tilde suffixes for use when parsing the RHS of an
|
||||
assignment statement and =~ should not be subject to tilde expansion
|
||||
- if ASSIGN_P argument to bash_tilde_expand is 2, use tilde prefixes
|
||||
for parsing RHS of assignment statement
|
||||
|
||||
general.[ch]
|
||||
- new function bash_tilde_find_word, drop-in replacement for
|
||||
tilde_find_word
|
||||
|
||||
subst.c
|
||||
- call bash_tilde_expand with secord argument of 2 when expanding rhs
|
||||
of an assignment statement, so tildes after second and subsequent
|
||||
`=' in an assignment are not expanded
|
||||
- new function, expand_string_assignment, to expand the rhs of an
|
||||
assignment statement
|
||||
- add `~' to EXP_CHAR, the characters that will cause the word
|
||||
expansion functions to be called
|
||||
- move tilde expansion into expand_word_internal instead of many
|
||||
different calls to bash_tilde_expand scattered across different
|
||||
functions. NOTE: This means that double quotes surrounding a
|
||||
{paramOPword} expansion will cause tilde expansion to NOT be
|
||||
performed on `word'. I think this is right, what POSIX specifies,
|
||||
and consistent with the behavior of other characters in the rhs
|
||||
|
||||
execute_cmd.c
|
||||
- take out calls to bash_tilde_expand before calling word expansion
|
||||
functions
|
||||
|
||||
+2
-2
@@ -23,8 +23,8 @@ $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
|
||||
$SHORT_DOC kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
|
||||
Send the processes named by PID (or JOBSPEC) 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
|
||||
|
||||
@@ -109,10 +109,12 @@ $END
|
||||
|
||||
$BUILTIN %
|
||||
$DOCNAME fg_percent
|
||||
$SHORT_DOC %JOBSPEC [&]
|
||||
This is similar to the `fg' command. Resume a stopped or background
|
||||
job specified by %JOBSPEC. Following the job specification with a `&'
|
||||
places the job in the background.
|
||||
$SHORT_DOC JOB_SPEC [&]
|
||||
Equivalent to the JOB_SPEC argument to the `fg' command. Resume a
|
||||
stopped or background job. JOB_SPEC can specify either a job name
|
||||
or a job number. Following JOB_SPEC with a `&' places the job in
|
||||
the background, as if the job specification had been supplied as an
|
||||
argument to `bg'.
|
||||
$END
|
||||
|
||||
$BUILTIN (( ... ))
|
||||
|
||||
@@ -78,6 +78,9 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
|
||||
#define W_DOLLARAT 0x0100 /* $@ and its special handling */
|
||||
#define W_DOLLARSTAR 0x0200 /* $* and its special handling */
|
||||
#define W_NOCOMSUB 0x0400 /* Don't perform command substitution on this word */
|
||||
#define W_ASSIGNRHS 0x0800 /* Word is rhs of an assignment statement */
|
||||
#define W_NOTILDE 0x1000 /* Don't perform tilde expansion on this word */
|
||||
#define W_ITILDE 0x2000 /* Internal flag for word expansion */
|
||||
|
||||
/* Possible values for subshell_environment */
|
||||
#define SUBSHELL_ASYNC 0x01 /* subshell caused by `command &' */
|
||||
|
||||
+337
@@ -0,0 +1,337 @@
|
||||
/* command.h -- The structures used internally to represent commands, and
|
||||
the extern declarations of the functions used to create them. */
|
||||
|
||||
/* Copyright (C) 1993 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 (_COMMAND_H_)
|
||||
#define _COMMAND_H_
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
/* Instructions describing what kind of thing to do for a redirection. */
|
||||
enum r_instruction {
|
||||
r_output_direction, r_input_direction, r_inputa_direction,
|
||||
r_appending_to, r_reading_until, r_reading_string,
|
||||
r_duplicating_input, r_duplicating_output, r_deblank_reading_until,
|
||||
r_close_this, r_err_and_out, r_input_output, r_output_force,
|
||||
r_duplicating_input_word, r_duplicating_output_word,
|
||||
r_move_input, r_move_output, r_move_input_word, r_move_output_word
|
||||
};
|
||||
|
||||
/* Redirection errors. */
|
||||
#define AMBIGUOUS_REDIRECT -1
|
||||
#define NOCLOBBER_REDIRECT -2
|
||||
#define RESTRICTED_REDIRECT -3 /* can only happen in restricted shells. */
|
||||
#define HEREDOC_REDIRECT -4 /* here-doc temp file can't be created */
|
||||
|
||||
#define CLOBBERING_REDIRECT(ri) \
|
||||
(ri == r_output_direction || ri == r_err_and_out)
|
||||
|
||||
#define OUTPUT_REDIRECT(ri) \
|
||||
(ri == r_output_direction || ri == r_input_output || ri == r_err_and_out)
|
||||
|
||||
#define INPUT_REDIRECT(ri) \
|
||||
(ri == r_input_direction || ri == r_inputa_direction || ri == r_input_output)
|
||||
|
||||
#define WRITE_REDIRECT(ri) \
|
||||
(ri == r_output_direction || \
|
||||
ri == r_input_output || \
|
||||
ri == r_err_and_out || \
|
||||
ri == r_appending_to || \
|
||||
ri == r_output_force)
|
||||
|
||||
/* redirection needs translation */
|
||||
#define TRANSLATE_REDIRECT(ri) \
|
||||
(ri == r_duplicating_input_word || ri == r_duplicating_output_word || \
|
||||
ri == r_move_input_word || ri == r_move_output_word)
|
||||
|
||||
/* Command Types: */
|
||||
enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
|
||||
cm_connection, cm_function_def, cm_until, cm_group,
|
||||
cm_arith, cm_cond, cm_arith_for, cm_subshell };
|
||||
|
||||
/* Possible values for the `flags' field of a WORD_DESC. */
|
||||
#define W_HASDOLLAR 0x0001 /* Dollar sign present. */
|
||||
#define W_QUOTED 0x0002 /* Some form of quote character is present. */
|
||||
#define W_ASSIGNMENT 0x0004 /* This word is a variable assignment. */
|
||||
#define W_GLOBEXP 0x0008 /* This word is the result of a glob expansion. */
|
||||
#define W_NOSPLIT 0x0010 /* Do not perform word splitting on this word. */
|
||||
#define W_NOGLOB 0x0020 /* Do not perform globbing on this word. */
|
||||
#define W_NOSPLIT2 0x0040 /* Don't split word except for $@ expansion. */
|
||||
#define W_TILDEEXP 0x0080 /* Tilde expand this assignment word */
|
||||
#define W_DOLLARAT 0x0100 /* $@ and its special handling */
|
||||
#define W_DOLLARSTAR 0x0200 /* $* and its special handling */
|
||||
#define W_NOCOMSUB 0x0400 /* Don't perform command substitution on this word */
|
||||
#define W_ASSIGNRHS 0x0800 /* Word is rhs of an assignment statement */
|
||||
#define W_NOTILDE 0x1000 /* Don't perform tilde expansion on this word */
|
||||
|
||||
/* Possible values for subshell_environment */
|
||||
#define SUBSHELL_ASYNC 0x01 /* subshell caused by `command &' */
|
||||
#define SUBSHELL_PAREN 0x02 /* subshell caused by ( ... ) */
|
||||
#define SUBSHELL_COMSUB 0x04 /* subshell caused by `command` or $(command) */
|
||||
#define SUBSHELL_FORK 0x08 /* subshell caused by executing a disk command */
|
||||
#define SUBSHELL_PIPE 0x10 /* subshell from a pipeline element */
|
||||
|
||||
/* A structure which represents a word. */
|
||||
typedef struct word_desc {
|
||||
char *word; /* Zero terminated string. */
|
||||
int flags; /* Flags associated with this word. */
|
||||
} WORD_DESC;
|
||||
|
||||
/* A linked list of words. */
|
||||
typedef struct word_list {
|
||||
struct word_list *next;
|
||||
WORD_DESC *word;
|
||||
} WORD_LIST;
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Shell Command Structs */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* What a redirection descriptor looks like. If the redirection instruction
|
||||
is ri_duplicating_input or ri_duplicating_output, use DEST, otherwise
|
||||
use the file in FILENAME. Out-of-range descriptors are identified by a
|
||||
negative DEST. */
|
||||
|
||||
typedef union {
|
||||
int dest; /* Place to redirect REDIRECTOR to, or ... */
|
||||
WORD_DESC *filename; /* filename to redirect to. */
|
||||
} REDIRECTEE;
|
||||
|
||||
/* Structure describing a redirection. If REDIRECTOR is negative, the parser
|
||||
(or translator in redir.c) encountered an out-of-range file descriptor. */
|
||||
typedef struct redirect {
|
||||
struct redirect *next; /* Next element, or NULL. */
|
||||
int redirector; /* Descriptor to be redirected. */
|
||||
int flags; /* Flag value for `open'. */
|
||||
enum r_instruction instruction; /* What to do with the information. */
|
||||
REDIRECTEE redirectee; /* File descriptor or filename */
|
||||
char *here_doc_eof; /* The word that appeared in <<foo. */
|
||||
} REDIRECT;
|
||||
|
||||
/* An element used in parsing. A single word or a single redirection.
|
||||
This is an ephemeral construct. */
|
||||
typedef struct element {
|
||||
WORD_DESC *word;
|
||||
REDIRECT *redirect;
|
||||
} ELEMENT;
|
||||
|
||||
/* Possible values for command->flags. */
|
||||
#define CMD_WANT_SUBSHELL 0x01 /* User wants a subshell: ( command ) */
|
||||
#define CMD_FORCE_SUBSHELL 0x02 /* Shell needs to force a subshell. */
|
||||
#define CMD_INVERT_RETURN 0x04 /* Invert the exit value. */
|
||||
#define CMD_IGNORE_RETURN 0x08 /* Ignore the exit value. For set -e. */
|
||||
#define CMD_NO_FUNCTIONS 0x10 /* Ignore functions during command lookup. */
|
||||
#define CMD_INHIBIT_EXPANSION 0x20 /* Do not expand the command words. */
|
||||
#define CMD_NO_FORK 0x40 /* Don't fork; just call execve */
|
||||
#define CMD_TIME_PIPELINE 0x80 /* Time a pipeline */
|
||||
#define CMD_TIME_POSIX 0x100 /* time -p; use POSIX.2 time output spec. */
|
||||
#define CMD_AMPERSAND 0x200 /* command & */
|
||||
#define CMD_STDIN_REDIR 0x400 /* async command needs implicit </dev/null */
|
||||
#define CMD_COMMAND_BUILTIN 0x0800 /* command executed by `command' builtin */
|
||||
|
||||
/* What a command looks like. */
|
||||
typedef struct command {
|
||||
enum command_type type; /* FOR CASE WHILE IF CONNECTION or SIMPLE. */
|
||||
int flags; /* Flags controlling execution environment. */
|
||||
int line; /* line number the command starts on */
|
||||
REDIRECT *redirects; /* Special redirects for FOR CASE, etc. */
|
||||
union {
|
||||
struct for_com *For;
|
||||
struct case_com *Case;
|
||||
struct while_com *While;
|
||||
struct if_com *If;
|
||||
struct connection *Connection;
|
||||
struct simple_com *Simple;
|
||||
struct function_def *Function_def;
|
||||
struct group_com *Group;
|
||||
#if defined (SELECT_COMMAND)
|
||||
struct select_com *Select;
|
||||
#endif
|
||||
#if defined (DPAREN_ARITHMETIC)
|
||||
struct arith_com *Arith;
|
||||
#endif
|
||||
#if defined (COND_COMMAND)
|
||||
struct cond_com *Cond;
|
||||
#endif
|
||||
#if defined (ARITH_FOR_COMMAND)
|
||||
struct arith_for_com *ArithFor;
|
||||
#endif
|
||||
struct subshell_com *Subshell;
|
||||
} value;
|
||||
} COMMAND;
|
||||
|
||||
/* Structure used to represent the CONNECTION type. */
|
||||
typedef struct connection {
|
||||
int ignore; /* Unused; simplifies make_command (). */
|
||||
COMMAND *first; /* Pointer to the first command. */
|
||||
COMMAND *second; /* Pointer to the second command. */
|
||||
int connector; /* What separates this command from others. */
|
||||
} CONNECTION;
|
||||
|
||||
/* Structures used to represent the CASE command. */
|
||||
|
||||
/* Pattern/action structure for CASE_COM. */
|
||||
typedef struct pattern_list {
|
||||
struct pattern_list *next; /* Clause to try in case this one failed. */
|
||||
WORD_LIST *patterns; /* Linked list of patterns to test. */
|
||||
COMMAND *action; /* Thing to execute if a pattern matches. */
|
||||
} PATTERN_LIST;
|
||||
|
||||
/* The CASE command. */
|
||||
typedef struct case_com {
|
||||
int flags; /* See description of CMD flags. */
|
||||
int line; /* line number the `case' keyword appears on */
|
||||
WORD_DESC *word; /* The thing to test. */
|
||||
PATTERN_LIST *clauses; /* The clauses to test against, or NULL. */
|
||||
} CASE_COM;
|
||||
|
||||
/* FOR command. */
|
||||
typedef struct for_com {
|
||||
int flags; /* See description of CMD flags. */
|
||||
int line; /* line number the `for' keyword appears on */
|
||||
WORD_DESC *name; /* The variable name to get mapped over. */
|
||||
WORD_LIST *map_list; /* The things to map over. This is never NULL. */
|
||||
COMMAND *action; /* The action to execute.
|
||||
During execution, NAME is bound to successive
|
||||
members of MAP_LIST. */
|
||||
} FOR_COM;
|
||||
|
||||
#if defined (ARITH_FOR_COMMAND)
|
||||
typedef struct arith_for_com {
|
||||
int flags;
|
||||
int line; /* generally used for error messages */
|
||||
WORD_LIST *init;
|
||||
WORD_LIST *test;
|
||||
WORD_LIST *step;
|
||||
COMMAND *action;
|
||||
} ARITH_FOR_COM;
|
||||
#endif
|
||||
|
||||
#if defined (SELECT_COMMAND)
|
||||
/* KSH SELECT command. */
|
||||
typedef struct select_com {
|
||||
int flags; /* See description of CMD flags. */
|
||||
int line; /* line number the `select' keyword appears on */
|
||||
WORD_DESC *name; /* The variable name to get mapped over. */
|
||||
WORD_LIST *map_list; /* The things to map over. This is never NULL. */
|
||||
COMMAND *action; /* The action to execute.
|
||||
During execution, NAME is bound to the member of
|
||||
MAP_LIST chosen by the user. */
|
||||
} SELECT_COM;
|
||||
#endif /* SELECT_COMMAND */
|
||||
|
||||
/* IF command. */
|
||||
typedef struct if_com {
|
||||
int flags; /* See description of CMD flags. */
|
||||
COMMAND *test; /* Thing to test. */
|
||||
COMMAND *true_case; /* What to do if the test returned non-zero. */
|
||||
COMMAND *false_case; /* What to do if the test returned zero. */
|
||||
} IF_COM;
|
||||
|
||||
/* WHILE command. */
|
||||
typedef struct while_com {
|
||||
int flags; /* See description of CMD flags. */
|
||||
COMMAND *test; /* Thing to test. */
|
||||
COMMAND *action; /* Thing to do while test is non-zero. */
|
||||
} WHILE_COM;
|
||||
|
||||
#if defined (DPAREN_ARITHMETIC)
|
||||
/* The arithmetic evaluation command, ((...)). Just a set of flags and
|
||||
a WORD_LIST, of which the first element is the only one used, for the
|
||||
time being. */
|
||||
typedef struct arith_com {
|
||||
int flags;
|
||||
int line;
|
||||
WORD_LIST *exp;
|
||||
} ARITH_COM;
|
||||
#endif /* DPAREN_ARITHMETIC */
|
||||
|
||||
/* The conditional command, [[...]]. This is a binary tree -- we slippped
|
||||
a recursive-descent parser into the YACC grammar to parse it. */
|
||||
#define COND_AND 1
|
||||
#define COND_OR 2
|
||||
#define COND_UNARY 3
|
||||
#define COND_BINARY 4
|
||||
#define COND_TERM 5
|
||||
#define COND_EXPR 6
|
||||
|
||||
typedef struct cond_com {
|
||||
int flags;
|
||||
int line;
|
||||
int type;
|
||||
WORD_DESC *op;
|
||||
struct cond_com *left, *right;
|
||||
} COND_COM;
|
||||
|
||||
/* The "simple" command. Just a collection of words and redirects. */
|
||||
typedef struct simple_com {
|
||||
int flags; /* See description of CMD flags. */
|
||||
int line; /* line number the command starts on */
|
||||
WORD_LIST *words; /* The program name, the arguments,
|
||||
variable assignments, etc. */
|
||||
REDIRECT *redirects; /* Redirections to perform. */
|
||||
} SIMPLE_COM;
|
||||
|
||||
/* The "function definition" command. */
|
||||
typedef struct function_def {
|
||||
int flags; /* See description of CMD flags. */
|
||||
int line; /* Line number the function def starts on. */
|
||||
WORD_DESC *name; /* The name of the function. */
|
||||
COMMAND *command; /* The parsed execution tree. */
|
||||
char *source_file; /* file in which function was defined, if any */
|
||||
} FUNCTION_DEF;
|
||||
|
||||
/* A command that is `grouped' allows pipes and redirections to affect all
|
||||
commands in the group. */
|
||||
typedef struct group_com {
|
||||
int ignore; /* See description of CMD flags. */
|
||||
COMMAND *command;
|
||||
} GROUP_COM;
|
||||
|
||||
typedef struct subshell_com {
|
||||
int flags;
|
||||
COMMAND *command;
|
||||
} SUBSHELL_COM;
|
||||
|
||||
extern COMMAND *global_command;
|
||||
|
||||
/* Possible command errors */
|
||||
#define CMDERR_DEFAULT 0
|
||||
#define CMDERR_BADTYPE 1
|
||||
#define CMDERR_BADCONN 2
|
||||
#define CMDERR_BADJUMP 3
|
||||
|
||||
#define CMDERR_LAST 3
|
||||
|
||||
/* Forward declarations of functions declared in copy_cmd.c. */
|
||||
|
||||
extern FUNCTION_DEF *copy_function_def_contents __P((FUNCTION_DEF *, FUNCTION_DEF *));
|
||||
extern FUNCTION_DEF *copy_function_def __P((FUNCTION_DEF *));
|
||||
|
||||
extern WORD_DESC *copy_word __P((WORD_DESC *));
|
||||
extern WORD_LIST *copy_word_list __P((WORD_LIST *));
|
||||
extern REDIRECT *copy_redirect __P((REDIRECT *));
|
||||
extern REDIRECT *copy_redirects __P((REDIRECT *));
|
||||
extern COMMAND *copy_command __P((COMMAND *));
|
||||
|
||||
#endif /* _COMMAND_H_ */
|
||||
+573
-568
File diff suppressed because it is too large
Load Diff
+3
-5
@@ -115,7 +115,7 @@ when invoking an interactive shell.
|
||||
.TP
|
||||
.B \-D
|
||||
A list of all double-quoted strings preceded by \fB$\fP
|
||||
is printed on the standard ouput.
|
||||
is printed on the standard output.
|
||||
These are the strings that
|
||||
are subject to language translation when the current locale
|
||||
is not \fBC\fP or \fBPOSIX\fP.
|
||||
@@ -1963,9 +1963,7 @@ job identifier (see
|
||||
.B JOB CONTROL
|
||||
below). If set to any other value, the supplied string must
|
||||
be a prefix of a stopped job's name; this provides functionality
|
||||
analogous to the
|
||||
.B %
|
||||
job identifier.
|
||||
analogous to the \fB%\fP\fIstring\fP job identifier.
|
||||
.TP
|
||||
.B histchars
|
||||
The two or three characters which control history expansion
|
||||
@@ -5287,7 +5285,7 @@ of an \fIinputrc\fP file.
|
||||
.TP
|
||||
.B dump\-macros
|
||||
Print all of the readline key sequences bound to macros and the
|
||||
strings they ouput. If a numeric argument is supplied,
|
||||
strings they output. If a numeric argument is supplied,
|
||||
the output is formatted in such a way that it can be made part
|
||||
of an \fIinputrc\fP file.
|
||||
.TP
|
||||
|
||||
+6
-8
@@ -6,12 +6,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@po.CWRU.Edu
|
||||
.\"
|
||||
.\" Last Change: Fri Aug 27 12:14:46 EDT 2004
|
||||
.\" Last Change: Fri Sep 17 22:44:17 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 June 26" "GNU Bash-3.0"
|
||||
.TH BASH 1 "2004 Sep 17" "GNU Bash-3.0"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -115,7 +115,7 @@ when invoking an interactive shell.
|
||||
.TP
|
||||
.B \-D
|
||||
A list of all double-quoted strings preceded by \fB$\fP
|
||||
is printed on the standard ouput.
|
||||
is printed on the standard output.
|
||||
These are the strings that
|
||||
are subject to language translation when the current locale
|
||||
is not \fBC\fP or \fBPOSIX\fP.
|
||||
@@ -1228,8 +1228,8 @@ The command argument to the \fB\-c\fP invocation option.
|
||||
An array variable whose members are the line numbers in source files
|
||||
corresponding to each member of \fBFUNCNAME\fP.
|
||||
\fB${BASH_LINENO[\fP\fI$i\fP\fB]}\fP is the line number in the source
|
||||
file where \fB${FUNCNAME[\fP\fI$i + 1\fP\fB]}\fP was called.
|
||||
The corresponding source file name is \fB${BASH_SOURCE[\fP\fI$i + 1\fP\fB]}\fB.
|
||||
file where \fB${FUNCNAME[\fP\fI$ifP\fB]}\fP was called.
|
||||
The corresponding source file name is \fB${BASH_SOURCE[\fP\fI$i\fP\fB]}\fB.
|
||||
Use \fBLINENO\fP to obtain the current line number.
|
||||
.TP
|
||||
.B BASH_REMATCH
|
||||
@@ -1963,9 +1963,7 @@ job identifier (see
|
||||
.B JOB CONTROL
|
||||
below). If set to any other value, the supplied string must
|
||||
be a prefix of a stopped job's name; this provides functionality
|
||||
analogous to the
|
||||
.B %
|
||||
job identifier.
|
||||
analogous to the \fB%\fP\fIstring\fP job identifier.
|
||||
.TP
|
||||
.B histchars
|
||||
The two or three characters which control history expansion
|
||||
|
||||
+11
-5
@@ -2,7 +2,7 @@
|
||||
<TITLE>BASH(1) Manual Page</TITLE>
|
||||
</HEAD>
|
||||
<BODY><TABLE WIDTH=100%>
|
||||
<TH ALIGN=LEFT>BASH(1)<TH ALIGN=CENTER>2004 June 26<TH ALIGN=RIGHT>BASH(1)
|
||||
<TH ALIGN=LEFT>BASH(1)<TH ALIGN=CENTER>2004 Sep 17<TH ALIGN=RIGHT>BASH(1)
|
||||
</TABLE>
|
||||
<BR><A HREF="#index">Index</A>
|
||||
<HR>
|
||||
@@ -1603,8 +1603,8 @@ The command argument to the <B>-c</B> invocation option.
|
||||
An array variable whose members are the line numbers in source files
|
||||
corresponding to each member of <B>FUNCNAME</B>.
|
||||
<B>${BASH_LINENO[</B><I>$i</I><B>]}</B> is the line number in the source
|
||||
file where <B>${FUNCNAME[</B><I>$i + 1</I><B>]}</B> was called.
|
||||
The corresponding source file name is <B>${BASH_SOURCE[</B><I>$i + 1</I><B>]}.
|
||||
file where <B>${FUNCNAME[</B><I>$ifP</I><B>]}</B> was called.
|
||||
The corresponding source file name is <B>${BASH_SOURCE[</B><I>$i</I><B>]}.
|
||||
Use LINENO</B> to obtain the current line number.
|
||||
<DT><B>BASH_REMATCH</B>
|
||||
|
||||
@@ -5096,7 +5096,7 @@ sends a
|
||||
to all jobs when an interactive login shell exits.
|
||||
<P>
|
||||
|
||||
If Bbash is waiting for a command to complete and receives a signal
|
||||
If <B>bash</B> is waiting for a command to complete and receives a signal
|
||||
for which a trap has been set, the trap will not be executed until
|
||||
the command completes.
|
||||
When <B>bash</B> is waiting for an asynchronous command via the <B>wait</B>
|
||||
@@ -8023,6 +8023,12 @@ suppressing trailing spaces). Intended to be used with shell functions.
|
||||
<DD>
|
||||
Tell readline not to append a space (the default) to words completed at
|
||||
the end of the line.
|
||||
<DT><B>plusdirs</B>
|
||||
|
||||
<DD>
|
||||
After any matches defined by the compspec are generated,
|
||||
directory name completion is attempted and any
|
||||
matches are added to the results of the other actions.
|
||||
</DL></DL>
|
||||
|
||||
<DT><B>-A</B> <I>action</I><DD>
|
||||
@@ -11367,6 +11373,6 @@ Array variables may not (yet) be exported.
|
||||
</DL>
|
||||
<HR>
|
||||
This document was created by man2html from bash.1.<BR>
|
||||
Time: 30 August 2004 08:27:20 EDT
|
||||
Time: 21 September 2004 11:57:09 EDT
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
+1251
-1243
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+15
-7
@@ -1,6 +1,6 @@
|
||||
<HTML>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<!-- Created on August, 30 2004 by texi2html 1.64 -->
|
||||
<!-- Created on September, 21 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, 27 August 2004)..
|
||||
the Bash shell (version 3.0, 17 September 2004)..
|
||||
</P><P>
|
||||
|
||||
This is Edition 3.0, last updated 27 August 2004,
|
||||
This is Edition 3.0, last updated 17 September 2004,
|
||||
of <CITE>The GNU Bash Reference Manual</CITE>,
|
||||
for <CODE>Bash</CODE>, Version 3.0.
|
||||
</P><P>
|
||||
@@ -5655,8 +5655,8 @@ The command argument to the <SAMP>`-c'</SAMP> invocation option.
|
||||
An array variable whose members are the line numbers in source files
|
||||
corresponding to each member of <VAR>FUNCNAME</VAR>.
|
||||
<CODE>${BASH_LINENO[$i]}</CODE> is the line number in the source file where
|
||||
<CODE>${FUNCNAME[$i + 1]}</CODE> was called.
|
||||
The corresponding source file name is <CODE>${BASH_SOURCE[$i + 1]}</CODE>.
|
||||
<CODE>${FUNCNAME[$i]}</CODE> was called.
|
||||
The corresponding source file name is <CODE>${BASH_SOURCE[$i]}</CODE>.
|
||||
Use <CODE>LINENO</CODE> to obtain the current line number.
|
||||
<P>
|
||||
|
||||
@@ -10744,6 +10744,14 @@ shell functions specified with <SAMP>`-F'</SAMP>.
|
||||
<DT><CODE>nospace</CODE>
|
||||
<DD>Tell Readline not to append a space (the default) to words completed at
|
||||
the end of the line.
|
||||
<P>
|
||||
|
||||
<DT><CODE>plusdirs</CODE>
|
||||
<DD>After any matches defined by the compspec are generated,
|
||||
directory name completion is attempted and any
|
||||
matches are added to the results of the other actions.
|
||||
<P>
|
||||
|
||||
</DL>
|
||||
<P>
|
||||
|
||||
@@ -15051,7 +15059,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>August, 30 2004</I>
|
||||
This document was generated by <I>Chet Ramey</I> on <I>September, 21 2004</I>
|
||||
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
|
||||
"><I>texi2html</I></A>
|
||||
<P></P>
|
||||
@@ -15213,7 +15221,7 @@ the following structure:
|
||||
<BR>
|
||||
<FONT SIZE="-1">
|
||||
This document was generated
|
||||
by <I>Chet Ramey</I> on <I>August, 30 2004</I>
|
||||
by <I>Chet Ramey</I> on <I>September, 21 2004</I>
|
||||
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
|
||||
"><I>texi2html</I></A>
|
||||
|
||||
|
||||
+141
-135
@@ -1,11 +1,11 @@
|
||||
This is bashref.info, produced by makeinfo version 4.7 from
|
||||
/Users/chet/src/bash/src/doc/bashref.texi.
|
||||
/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, 27 August 2004).
|
||||
the Bash shell (version 3.0, 17 September 2004).
|
||||
|
||||
This is Edition 3.0, last updated 27 August 2004, of `The GNU Bash
|
||||
Reference Manual', for `Bash', Version 3.0.
|
||||
This is Edition 3.0, last updated 17 September 2004, of `The GNU
|
||||
Bash Reference Manual', for `Bash', Version 3.0.
|
||||
|
||||
Copyright (C) 1988-2004 Free Software Foundation, Inc.
|
||||
|
||||
@@ -37,10 +37,10 @@ Bash Features
|
||||
*************
|
||||
|
||||
This text is a brief description of the features that are present in
|
||||
the Bash shell (version 3.0, 27 August 2004)..
|
||||
the Bash shell (version 3.0, 17 September 2004)..
|
||||
|
||||
This is Edition 3.0, last updated 27 August 2004, of `The GNU Bash
|
||||
Reference Manual', for `Bash', Version 3.0.
|
||||
This is Edition 3.0, last updated 17 September 2004, of `The GNU
|
||||
Bash Reference Manual', for `Bash', Version 3.0.
|
||||
|
||||
Bash contains features that appear in other popular shells, and some
|
||||
features that only appear in Bash. Some of the shells that Bash has
|
||||
@@ -3721,9 +3721,9 @@ Variables::).
|
||||
An array variable whose members are the line numbers in source
|
||||
files corresponding to each member of FUNCNAME.
|
||||
`${BASH_LINENO[$i]}' is the line number in the source file where
|
||||
`${FUNCNAME[$i + 1]}' was called. The corresponding source file
|
||||
name is `${BASH_SOURCE[$i + 1]}'. Use `LINENO' to obtain the
|
||||
current line number.
|
||||
`${FUNCNAME[$i]}' was called. The corresponding source file name
|
||||
is `${BASH_SOURCE[$i]}'. Use `LINENO' to obtain the current line
|
||||
number.
|
||||
|
||||
`BASH_REMATCH'
|
||||
An array variable whose members are assigned by the `=~' binary
|
||||
@@ -7086,6 +7086,12 @@ completion facilities.
|
||||
Tell Readline not to append a space (the default) to
|
||||
words completed at the end of the line.
|
||||
|
||||
`plusdirs'
|
||||
After any matches defined by the compspec are generated,
|
||||
directory name completion is attempted and any matches
|
||||
are added to the results of the other actions.
|
||||
|
||||
|
||||
`-A ACTION'
|
||||
The ACTION may be one of the following to generate a list of
|
||||
possible completions:
|
||||
@@ -9326,7 +9332,7 @@ Concept Index
|
||||
* history list: Bash History Facilities.
|
||||
(line 6)
|
||||
* History, how to use: Programmable Completion Builtins.
|
||||
(line 203)
|
||||
(line 209)
|
||||
* identifier: Definitions. (line 49)
|
||||
* initialization file, readline: Readline Init File. (line 6)
|
||||
* installation: Basic Installation. (line 6)
|
||||
@@ -9403,129 +9409,129 @@ Concept Index
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Top1353
|
||||
Node: Introduction3493
|
||||
Node: What is Bash?3722
|
||||
Node: What is a shell?4815
|
||||
Node: Definitions7356
|
||||
Node: Basic Shell Features10097
|
||||
Node: Shell Syntax11316
|
||||
Node: Shell Operation12348
|
||||
Node: Quoting13642
|
||||
Node: Escape Character14916
|
||||
Node: Single Quotes15401
|
||||
Node: Double Quotes15749
|
||||
Node: ANSI-C Quoting16775
|
||||
Node: Locale Translation17731
|
||||
Node: Comments18627
|
||||
Node: Shell Commands19241
|
||||
Node: Simple Commands20007
|
||||
Node: Pipelines20638
|
||||
Node: Lists22513
|
||||
Node: Compound Commands24144
|
||||
Node: Looping Constructs24928
|
||||
Node: Conditional Constructs27375
|
||||
Node: Command Grouping34442
|
||||
Node: Shell Functions35891
|
||||
Node: Shell Parameters40159
|
||||
Node: Positional Parameters41740
|
||||
Node: Special Parameters42640
|
||||
Node: Shell Expansions45565
|
||||
Node: Brace Expansion47490
|
||||
Node: Tilde Expansion49815
|
||||
Node: Shell Parameter Expansion52156
|
||||
Node: Command Substitution59419
|
||||
Node: Arithmetic Expansion60752
|
||||
Node: Process Substitution61602
|
||||
Node: Word Splitting62652
|
||||
Node: Filename Expansion64113
|
||||
Node: Pattern Matching66249
|
||||
Node: Quote Removal69582
|
||||
Node: Redirections69877
|
||||
Node: Executing Commands77456
|
||||
Node: Simple Command Expansion78131
|
||||
Node: Command Search and Execution80061
|
||||
Node: Command Execution Environment82067
|
||||
Node: Environment84838
|
||||
Node: Exit Status86498
|
||||
Node: Signals87702
|
||||
Node: Shell Scripts89666
|
||||
Node: Shell Builtin Commands92184
|
||||
Node: Bourne Shell Builtins93763
|
||||
Node: Bash Builtins110716
|
||||
Node: The Set Builtin138843
|
||||
Node: Special Builtins147066
|
||||
Node: Shell Variables148043
|
||||
Node: Bourne Shell Variables148483
|
||||
Node: Bash Variables150464
|
||||
Node: Bash Features170179
|
||||
Node: Invoking Bash171062
|
||||
Node: Bash Startup Files176881
|
||||
Node: Interactive Shells181739
|
||||
Node: What is an Interactive Shell?182149
|
||||
Node: Is this Shell Interactive?182799
|
||||
Node: Interactive Shell Behavior183614
|
||||
Node: Bash Conditional Expressions186890
|
||||
Node: Shell Arithmetic190469
|
||||
Node: Aliases193214
|
||||
Node: Arrays195782
|
||||
Node: The Directory Stack199049
|
||||
Node: Directory Stack Builtins199763
|
||||
Node: Printing a Prompt202654
|
||||
Node: The Restricted Shell205368
|
||||
Node: Bash POSIX Mode207200
|
||||
Node: Job Control214533
|
||||
Node: Job Control Basics215000
|
||||
Node: Job Control Builtins219290
|
||||
Node: Job Control Variables223633
|
||||
Node: Command Line Editing224791
|
||||
Node: Introduction and Notation225790
|
||||
Node: Readline Interaction227412
|
||||
Node: Readline Bare Essentials228603
|
||||
Node: Readline Movement Commands230392
|
||||
Node: Readline Killing Commands231357
|
||||
Node: Readline Arguments233277
|
||||
Node: Searching234321
|
||||
Node: Readline Init File236507
|
||||
Node: Readline Init File Syntax237566
|
||||
Node: Conditional Init Constructs249219
|
||||
Node: Sample Init File251752
|
||||
Node: Bindable Readline Commands254869
|
||||
Node: Commands For Moving256076
|
||||
Node: Commands For History256937
|
||||
Node: Commands For Text259838
|
||||
Node: Commands For Killing262511
|
||||
Node: Numeric Arguments264653
|
||||
Node: Commands For Completion265792
|
||||
Node: Keyboard Macros269385
|
||||
Node: Miscellaneous Commands269956
|
||||
Node: Readline vi Mode275267
|
||||
Node: Programmable Completion276181
|
||||
Node: Programmable Completion Builtins281993
|
||||
Node: Using History Interactively289363
|
||||
Node: Bash History Facilities290043
|
||||
Node: Bash History Builtins292738
|
||||
Node: History Interaction296595
|
||||
Node: Event Designators299151
|
||||
Node: Word Designators300166
|
||||
Node: Modifiers301805
|
||||
Node: Installing Bash303211
|
||||
Node: Basic Installation304348
|
||||
Node: Compilers and Options307040
|
||||
Node: Compiling For Multiple Architectures307781
|
||||
Node: Installation Names309445
|
||||
Node: Specifying the System Type310263
|
||||
Node: Sharing Defaults310979
|
||||
Node: Operation Controls311652
|
||||
Node: Optional Features312610
|
||||
Node: Reporting Bugs320889
|
||||
Node: Major Differences From The Bourne Shell322083
|
||||
Node: Copying This Manual337855
|
||||
Node: GNU Free Documentation License338131
|
||||
Node: Builtin Index360537
|
||||
Node: Reserved Word Index367086
|
||||
Node: Variable Index369522
|
||||
Node: Function Index380241
|
||||
Node: Concept Index386961
|
||||
Node: Top1363
|
||||
Node: Introduction3509
|
||||
Node: What is Bash?3738
|
||||
Node: What is a shell?4831
|
||||
Node: Definitions7372
|
||||
Node: Basic Shell Features10113
|
||||
Node: Shell Syntax11332
|
||||
Node: Shell Operation12364
|
||||
Node: Quoting13658
|
||||
Node: Escape Character14932
|
||||
Node: Single Quotes15417
|
||||
Node: Double Quotes15765
|
||||
Node: ANSI-C Quoting16791
|
||||
Node: Locale Translation17747
|
||||
Node: Comments18643
|
||||
Node: Shell Commands19257
|
||||
Node: Simple Commands20023
|
||||
Node: Pipelines20654
|
||||
Node: Lists22529
|
||||
Node: Compound Commands24160
|
||||
Node: Looping Constructs24944
|
||||
Node: Conditional Constructs27391
|
||||
Node: Command Grouping34458
|
||||
Node: Shell Functions35907
|
||||
Node: Shell Parameters40175
|
||||
Node: Positional Parameters41756
|
||||
Node: Special Parameters42656
|
||||
Node: Shell Expansions45581
|
||||
Node: Brace Expansion47506
|
||||
Node: Tilde Expansion49831
|
||||
Node: Shell Parameter Expansion52172
|
||||
Node: Command Substitution59435
|
||||
Node: Arithmetic Expansion60768
|
||||
Node: Process Substitution61618
|
||||
Node: Word Splitting62668
|
||||
Node: Filename Expansion64129
|
||||
Node: Pattern Matching66265
|
||||
Node: Quote Removal69598
|
||||
Node: Redirections69893
|
||||
Node: Executing Commands77472
|
||||
Node: Simple Command Expansion78147
|
||||
Node: Command Search and Execution80077
|
||||
Node: Command Execution Environment82083
|
||||
Node: Environment84854
|
||||
Node: Exit Status86514
|
||||
Node: Signals87718
|
||||
Node: Shell Scripts89682
|
||||
Node: Shell Builtin Commands92200
|
||||
Node: Bourne Shell Builtins93779
|
||||
Node: Bash Builtins110732
|
||||
Node: The Set Builtin138859
|
||||
Node: Special Builtins147082
|
||||
Node: Shell Variables148059
|
||||
Node: Bourne Shell Variables148499
|
||||
Node: Bash Variables150480
|
||||
Node: Bash Features170187
|
||||
Node: Invoking Bash171070
|
||||
Node: Bash Startup Files176889
|
||||
Node: Interactive Shells181747
|
||||
Node: What is an Interactive Shell?182157
|
||||
Node: Is this Shell Interactive?182807
|
||||
Node: Interactive Shell Behavior183622
|
||||
Node: Bash Conditional Expressions186898
|
||||
Node: Shell Arithmetic190477
|
||||
Node: Aliases193222
|
||||
Node: Arrays195790
|
||||
Node: The Directory Stack199057
|
||||
Node: Directory Stack Builtins199771
|
||||
Node: Printing a Prompt202662
|
||||
Node: The Restricted Shell205376
|
||||
Node: Bash POSIX Mode207208
|
||||
Node: Job Control214541
|
||||
Node: Job Control Basics215008
|
||||
Node: Job Control Builtins219298
|
||||
Node: Job Control Variables223641
|
||||
Node: Command Line Editing224799
|
||||
Node: Introduction and Notation225798
|
||||
Node: Readline Interaction227420
|
||||
Node: Readline Bare Essentials228611
|
||||
Node: Readline Movement Commands230400
|
||||
Node: Readline Killing Commands231365
|
||||
Node: Readline Arguments233285
|
||||
Node: Searching234329
|
||||
Node: Readline Init File236515
|
||||
Node: Readline Init File Syntax237574
|
||||
Node: Conditional Init Constructs249227
|
||||
Node: Sample Init File251760
|
||||
Node: Bindable Readline Commands254877
|
||||
Node: Commands For Moving256084
|
||||
Node: Commands For History256945
|
||||
Node: Commands For Text259846
|
||||
Node: Commands For Killing262519
|
||||
Node: Numeric Arguments264661
|
||||
Node: Commands For Completion265800
|
||||
Node: Keyboard Macros269393
|
||||
Node: Miscellaneous Commands269964
|
||||
Node: Readline vi Mode275275
|
||||
Node: Programmable Completion276189
|
||||
Node: Programmable Completion Builtins282001
|
||||
Node: Using History Interactively289597
|
||||
Node: Bash History Facilities290277
|
||||
Node: Bash History Builtins292972
|
||||
Node: History Interaction296829
|
||||
Node: Event Designators299385
|
||||
Node: Word Designators300400
|
||||
Node: Modifiers302039
|
||||
Node: Installing Bash303445
|
||||
Node: Basic Installation304582
|
||||
Node: Compilers and Options307274
|
||||
Node: Compiling For Multiple Architectures308015
|
||||
Node: Installation Names309679
|
||||
Node: Specifying the System Type310497
|
||||
Node: Sharing Defaults311213
|
||||
Node: Operation Controls311886
|
||||
Node: Optional Features312844
|
||||
Node: Reporting Bugs321123
|
||||
Node: Major Differences From The Bourne Shell322317
|
||||
Node: Copying This Manual338089
|
||||
Node: GNU Free Documentation License338365
|
||||
Node: Builtin Index360771
|
||||
Node: Reserved Word Index367320
|
||||
Node: Variable Index369756
|
||||
Node: Function Index380475
|
||||
Node: Concept Index387195
|
||||
|
||||
End Tag Table
|
||||
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
This is TeX, Version 3.14159 (Web2C 7.4.5) (format=tex 2003.12.31) 30 AUG 2004 08:27
|
||||
**/Users/chet/src/bash/src/doc/bashref.texi
|
||||
(/Users/chet/src/bash/src/doc/bashref.texi (./texinfo.tex
|
||||
This is TeX, Version 3.14159 (Web2C 7.4.5) (format=tex 2003.12.31) 21 SEP 2004 11:57
|
||||
**/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,
|
||||
\bindingoffset=\dimen16
|
||||
\normaloffset=\dimen17
|
||||
@@ -266,8 +266,8 @@ the file
|
||||
|
||||
[65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78]
|
||||
Chapter 7 [79] [80] [81] [82] [83]
|
||||
(/Users/chet/src/bash/src/lib/readline/doc/rluser.texi Chapter 8 [84] [85]
|
||||
[86] [87] [88] [89]
|
||||
(/usr/homes/chet/src/bash/src/lib/readline/doc/rluser.texi Chapter 8 [84]
|
||||
[85] [86] [87] [88] [89]
|
||||
Underfull \hbox (badness 5231) in paragraph at lines 488--504
|
||||
@texttt emacs-meta[]@textrm , @texttt emacs-ctlx[]@textrm , @texttt vi[]@textr
|
||||
m , @texttt vi-move[]@textrm , @texttt vi-command[]@textrm , and
|
||||
@@ -307,7 +307,7 @@ tttsl ac-tion@texttt ] [-G @textttsl glob-
|
||||
.etc.
|
||||
|
||||
[107] [108]
|
||||
Underfull \hbox (badness 2753) in paragraph at lines 1742--1745
|
||||
Underfull \hbox (badness 2753) in paragraph at lines 1748--1751
|
||||
@texttt hostname[]@textrm Hostnames, as taken from the file spec-i-fied by
|
||||
|
||||
@hbox(7.60416+2.12917)x433.62, glue set 3.02202
|
||||
@@ -318,7 +318,7 @@ Underfull \hbox (badness 2753) in paragraph at lines 1742--1745
|
||||
.@texttt o
|
||||
.etc.
|
||||
|
||||
[109]) (/Users/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9
|
||||
[109]) (/usr/homes/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9
|
||||
[110] [111] [112] [113] [114]) Chapter 10 [115] [116] [117] [118] [119]
|
||||
Underfull \hbox (badness 2772) in paragraph at lines 6642--6646
|
||||
[]@textrm Enable sup-port for large files (@texttt http://www.sas.com/standard
|
||||
@@ -358,11 +358,11 @@ Overfull \vbox (42.26959pt too high) has occurred while \output is active
|
||||
(Concept Index) [148] (./bashref.cps [149]) [150] )
|
||||
Here is how much of TeX's memory you used:
|
||||
1726 strings out of 98002
|
||||
23501 string characters out of 1221986
|
||||
52369 words of memory out of 1000001
|
||||
23533 string characters out of 1221986
|
||||
52375 words of memory out of 1000001
|
||||
2577 multiletter control sequences out of 10000+50000
|
||||
31953 words of font info for 111 fonts, out of 500000 for 1000
|
||||
19 hyphenation exceptions out of 1000
|
||||
15i,8n,11p,269b,465s stack positions out of 1500i,500n,5000p,200000b,5000s
|
||||
15i,8n,11p,273b,465s stack positions out of 1500i,500n,5000p,200000b,5000s
|
||||
|
||||
Output written on bashref.dvi (156 pages, 581772 bytes).
|
||||
Output written on bashref.dvi (156 pages, 582000 bytes).
|
||||
|
||||
+143
-140
@@ -10,7 +10,7 @@
|
||||
%DVIPSWebPage: (www.radicaleye.com)
|
||||
%DVIPSCommandLine: dvips -D 600 -t letter -o bashref.ps bashref.dvi
|
||||
%DVIPSParameters: dpi=600, compressed
|
||||
%DVIPSSource: TeX output 2004.08.30:0827
|
||||
%DVIPSSource: TeX output 2004.09.21:1157
|
||||
%%BeginProcSet: texc.pro
|
||||
%!
|
||||
/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
|
||||
@@ -4226,29 +4226,29 @@ letter
|
||||
TeXDict begin 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)i(for)d(Bash)2428 1589 y(Edition)h(3.0,)g(for)f
|
||||
Fs(Bash)g Ft(V)-8 b(ersion)31 b(3.0.)3252 1697 y(August)f(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
|
||||
Fs(Bash)g Ft(V)-8 b(ersion)31 b(3.0.)3118 1697 y(Septem)m(b)s(er)f
|
||||
(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
|
||||
b(oundation)p 150 5141 3600 17 v eop end
|
||||
%%Page: 2 2
|
||||
TeXDict begin 2 1 bop 150 2889 a Ft(This)35 b(text)h(is)g(a)g(brief)f
|
||||
(description)h(of)f(the)h(features)g(that)g(are)g(presen)m(t)g(in)f
|
||||
(the)h(Bash)f(shell)h(\(v)m(ersion)150 2999 y(3.0,)c(27)f(August)f
|
||||
(2004\).)150 3133 y(This)e(is)g(Edition)h(3.0,)h(last)f(up)s(dated)e
|
||||
(27)i(August)f(2004,)j(of)e Fq(The)f(GNU)h(Bash)f(Reference)h(Man)m
|
||||
(ual)p Ft(,)h(for)150 3243 y Fs(Bash)p Ft(,)f(V)-8 b(ersion)31
|
||||
b(3.0.)150 3377 y(Cop)m(yrigh)m(t)602 3374 y(c)577 3377
|
||||
y Fp(\015)f Ft(1988-2004)k(F)-8 b(ree)32 b(Soft)m(w)m(are)f(F)-8
|
||||
b(oundation,)32 b(Inc.)150 3512 y(P)m(ermission)g(is)h(gran)m(ted)g(to)
|
||||
f(mak)m(e)i(and)d(distribute)h(v)m(erbatim)h(copies)g(of)f(this)g(man)m
|
||||
(ual)h(pro)m(vided)f(the)150 3621 y(cop)m(yrigh)m(t)g(notice)f(and)f
|
||||
(this)g(p)s(ermission)g(notice)h(are)g(preserv)m(ed)f(on)h(all)g
|
||||
(copies.)390 3756 y(P)m(ermission)k(is)h(gran)m(ted)f(to)h(cop)m(y)-8
|
||||
b(,)38 b(distribute)d(and/or)g(mo)s(dify)f(this)h(do)s(cumen)m(t)g
|
||||
(under)390 3866 y(the)j(terms)g(of)g(the)g(GNU)h(F)-8
|
||||
b(ree)39 b(Do)s(cumen)m(tation)h(License,)g(V)-8 b(ersion)39
|
||||
b(1.1)g(or)f(an)m(y)g(later)390 3975 y(v)m(ersion)28
|
||||
(the)h(Bash)f(shell)h(\(v)m(ersion)150 2999 y(3.0,)c(17)f(Septem)m(b)s
|
||||
(er)f(2004\).)150 3133 y(This)e(is)h(Edition)f(3.0,)j(last)e(up)s
|
||||
(dated)f(17)h(Septem)m(b)s(er)f(2004,)j(of)e Fq(The)f(GNU)i(Bash)e
|
||||
(Reference)i(Man)m(ual)p Ft(,)150 3243 y(for)g Fs(Bash)p
|
||||
Ft(,)g(V)-8 b(ersion)31 b(3.0.)150 3377 y(Cop)m(yrigh)m(t)602
|
||||
3374 y(c)577 3377 y Fp(\015)f Ft(1988-2004)k(F)-8 b(ree)32
|
||||
b(Soft)m(w)m(are)f(F)-8 b(oundation,)32 b(Inc.)150 3512
|
||||
y(P)m(ermission)g(is)h(gran)m(ted)g(to)f(mak)m(e)i(and)d(distribute)h
|
||||
(v)m(erbatim)h(copies)g(of)f(this)g(man)m(ual)h(pro)m(vided)f(the)150
|
||||
3621 y(cop)m(yrigh)m(t)g(notice)f(and)f(this)g(p)s(ermission)g(notice)h
|
||||
(are)g(preserv)m(ed)f(on)h(all)g(copies.)390 3756 y(P)m(ermission)k(is)
|
||||
h(gran)m(ted)f(to)h(cop)m(y)-8 b(,)38 b(distribute)d(and/or)g(mo)s
|
||||
(dify)f(this)h(do)s(cumen)m(t)g(under)390 3866 y(the)j(terms)g(of)g
|
||||
(the)g(GNU)h(F)-8 b(ree)39 b(Do)s(cumen)m(tation)h(License,)g(V)-8
|
||||
b(ersion)39 b(1.1)g(or)f(an)m(y)g(later)390 3975 y(v)m(ersion)28
|
||||
b(published)d(b)m(y)j(the)f(F)-8 b(ree)29 b(Soft)m(w)m(are)f(F)-8
|
||||
b(oundation;)30 b(with)d(no)g(In)m(v)-5 b(arian)m(t)28
|
||||
b(Sections,)390 4085 y(with)i(the)h(F)-8 b(ron)m(t-Co)m(v)m(er)33
|
||||
@@ -8498,16 +8498,16 @@ b(ariable)39 b(whose)g(mem)m(b)s(ers)e(are)i(the)g(line)g(n)m(um)m(b)s
|
||||
(ers)e(in)h(source)h(\014les)f(corre-)630 3014 y(sp)s(onding)h(to)i
|
||||
(eac)m(h)g(mem)m(b)s(er)e(of)i Fq(FUNCNAME)p Ft(.)g Fs
|
||||
(${BASH_LINENO[$i]})35 b Ft(is)40 b(the)h(line)630 3124
|
||||
y(n)m(um)m(b)s(er)34 b(in)g(the)h(source)g(\014le)g(where)f
|
||||
Fs(${FUNCNAME[$i)27 b(+)j(1]})k Ft(w)m(as)h(called.)56
|
||||
b(The)34 b(corre-)630 3233 y(sp)s(onding)e(source)i(\014le)g(name)g(is)
|
||||
g Fs(${BASH_SOURCE[$i)26 b(+)k(1]})p Ft(.)50 b(Use)35
|
||||
b Fs(LINENO)d Ft(to)i(obtain)630 3343 y(the)d(curren)m(t)f(line)g(n)m
|
||||
(um)m(b)s(er.)150 3513 y Fs(BASH_REMATCH)630 3623 y Ft(An)43
|
||||
b(arra)m(y)i(v)-5 b(ariable)44 b(whose)g(mem)m(b)s(ers)f(are)h
|
||||
(assigned)g(b)m(y)f(the)h(`)p Fs(=~)p Ft(')g(binary)f(op)s(erator)630
|
||||
3733 y(to)37 b(the)f Fs([[)g Ft(conditional)i(command)e(\(see)h
|
||||
(Section)g(3.2.4.2)i([Conditional)e(Constructs],)630
|
||||
y(n)m(um)m(b)s(er)26 b(in)i(the)g(source)f(\014le)h(where)f
|
||||
Fs(${FUNCNAME[$i]})d Ft(w)m(as)k(called.)41 b(The)27
|
||||
b(corresp)s(ond-)630 3233 y(ing)f(source)h(\014le)f(name)g(is)h
|
||||
Fs(${BASH_SOURCE[$i]})p Ft(.)34 b(Use)27 b Fs(LINENO)d
|
||||
Ft(to)j(obtain)g(the)f(curren)m(t)630 3343 y(line)31
|
||||
b(n)m(um)m(b)s(er.)150 3513 y Fs(BASH_REMATCH)630 3623
|
||||
y Ft(An)43 b(arra)m(y)i(v)-5 b(ariable)44 b(whose)g(mem)m(b)s(ers)f
|
||||
(are)h(assigned)g(b)m(y)f(the)h(`)p Fs(=~)p Ft(')g(binary)f(op)s
|
||||
(erator)630 3733 y(to)37 b(the)f Fs([[)g Ft(conditional)i(command)e
|
||||
(\(see)h(Section)g(3.2.4.2)i([Conditional)e(Constructs],)630
|
||||
3842 y(page)e(10\).)52 b(The)33 b(elemen)m(t)j(with)d(index)g(0)i(is)f
|
||||
(the)g(p)s(ortion)f(of)h(the)g(string)g(matc)m(hing)h(the)630
|
||||
3952 y(en)m(tire)29 b(regular)f(expression.)40 b(The)27
|
||||
@@ -11951,144 +11951,147 @@ b(Reference)g(Man)m(ual)630 299 y(The)e(pro)s(cess)g(of)h(applying)g
|
||||
(these)g(completion)g(sp)s(eci\014cations)h(when)d(w)m(ord)i
|
||||
(completion)630 408 y(is)35 b(attempted)h(is)f(describ)s(ed)f(ab)s(o)m
|
||||
(v)m(e)j(\(see)f(Section)g(8.6)g([Programmable)g(Completion],)630
|
||||
518 y(page)31 b(105\).)630 652 y(Other)41 b(options,)46
|
||||
518 y(page)31 b(105\).)630 650 y(Other)41 b(options,)46
|
||||
b(if)41 b(sp)s(eci\014ed,)j(ha)m(v)m(e)f(the)f(follo)m(wing)i
|
||||
(meanings.)75 b(The)41 b(argumen)m(ts)h(to)630 762 y(the)e(`)p
|
||||
(meanings.)75 b(The)41 b(argumen)m(ts)h(to)630 760 y(the)e(`)p
|
||||
Fs(-G)p Ft(',)j(`)p Fs(-W)p Ft(',)g(and)d(`)p Fs(-X)p
|
||||
Ft(')g(options)g(\(and,)j(if)d(necessary)-8 b(,)44 b(the)c(`)p
|
||||
Fs(-P)p Ft(')h(and)e(`)p Fs(-S)p Ft(')h(options\))630
|
||||
872 y(should)30 b(b)s(e)h(quoted)g(to)h(protect)g(them)f(from)g
|
||||
869 y(should)30 b(b)s(e)h(quoted)g(to)h(protect)g(them)f(from)g
|
||||
(expansion)g(b)s(efore)g(the)g Fs(complete)e Ft(builtin)630
|
||||
981 y(is)h(in)m(v)m(ok)m(ed.)630 1140 y Fs(-o)g Fj(comp-option)1110
|
||||
1250 y Ft(The)c Fq(comp-option)i Ft(con)m(trols)g(sev)m(eral)h(asp)s
|
||||
979 y(is)h(in)m(v)m(ok)m(ed.)630 1134 y Fs(-o)g Fj(comp-option)1110
|
||||
1244 y Ft(The)c Fq(comp-option)i Ft(con)m(trols)g(sev)m(eral)h(asp)s
|
||||
(ects)e(of)g(the)g(compsp)s(ec's)g(b)s(eha)m(v-)1110
|
||||
1359 y(ior)g(b)s(ey)m(ond)f(the)g(simple)h(generation)h(of)e
|
||||
1353 y(ior)g(b)s(ey)m(ond)f(the)g(simple)h(generation)h(of)e
|
||||
(completions.)41 b Fq(comp-option)27 b Ft(ma)m(y)1110
|
||||
1469 y(b)s(e)j(one)g(of:)1110 1628 y Fs(bashdefault)1590
|
||||
1738 y Ft(P)m(erform)d(the)h(rest)f(of)h(the)g(default)f(Bash)h
|
||||
(completions)g(if)g(the)1590 1847 y(compsp)s(ec)i(generates)i(no)e
|
||||
(matc)m(hes.)1110 2006 y Fs(default)144 b Ft(Use)22 b(Readline's)g
|
||||
1463 y(b)s(e)j(one)g(of:)1110 1618 y Fs(bashdefault)1590
|
||||
1727 y Ft(P)m(erform)d(the)h(rest)f(of)h(the)g(default)f(Bash)h
|
||||
(completions)g(if)g(the)1590 1837 y(compsp)s(ec)i(generates)i(no)e
|
||||
(matc)m(hes.)1110 1992 y Fs(default)144 b Ft(Use)22 b(Readline's)g
|
||||
(default)g(\014lename)g(completion)g(if)g(the)g(comp-)1590
|
||||
2116 y(sp)s(ec)30 b(generates)i(no)e(matc)m(hes.)1110
|
||||
2275 y Fs(dirnames)96 b Ft(P)m(erform)46 b(directory)g(name)h
|
||||
(completion)g(if)f(the)g(compsp)s(ec)1590 2385 y(generates)32
|
||||
b(no)e(matc)m(hes.)1110 2544 y Fs(filenames)1590 2653
|
||||
2101 y(sp)s(ec)30 b(generates)i(no)e(matc)m(hes.)1110
|
||||
2256 y Fs(dirnames)96 b Ft(P)m(erform)46 b(directory)g(name)h
|
||||
(completion)g(if)f(the)g(compsp)s(ec)1590 2366 y(generates)32
|
||||
b(no)e(matc)m(hes.)1110 2521 y Fs(filenames)1590 2630
|
||||
y Ft(T)-8 b(ell)40 b(Readline)f(that)h(the)f(compsp)s(ec)f(generates)j
|
||||
(\014lenames,)1590 2763 y(so)29 b(it)h(can)f(p)s(erform)f(an)m(y)h
|
||||
(\014lenames,)1590 2740 y(so)29 b(it)h(can)f(p)s(erform)f(an)m(y)h
|
||||
(\014lename-sp)s(eci\014c)h(pro)s(cessing)e(\(lik)m(e)1590
|
||||
2872 y(adding)h(a)h(slash)f(to)h(directory)g(names)f(or)g(suppressing)f
|
||||
(trail-)1590 2982 y(ing)38 b(spaces\).)66 b(This)37 b(option)i(is)f(in)
|
||||
m(tended)g(to)h(b)s(e)f(used)f(with)1590 3092 y(shell)31
|
||||
2850 y(adding)h(a)h(slash)f(to)h(directory)g(names)f(or)g(suppressing)f
|
||||
(trail-)1590 2959 y(ing)38 b(spaces\).)66 b(This)37 b(option)i(is)f(in)
|
||||
m(tended)g(to)h(b)s(e)f(used)f(with)1590 3069 y(shell)31
|
||||
b(functions)f(sp)s(eci\014ed)f(with)h(`)p Fs(-F)p Ft('.)1110
|
||||
3251 y Fs(nospace)144 b Ft(T)-8 b(ell)40 b(Readline)g(not)g(to)g(app)s
|
||||
(end)d(a)j(space)g(\(the)f(default\))h(to)1590 3360 y(w)m(ords)30
|
||||
b(completed)h(at)g(the)g(end)f(of)g(the)h(line.)630 3519
|
||||
y Fs(-A)f Fj(action)1110 3629 y Ft(The)25 b Fq(action)h
|
||||
Ft(ma)m(y)g(b)s(e)e(one)h(of)h(the)f(follo)m(wing)i(to)e(generate)i(a)e
|
||||
(list)h(of)f(p)s(ossible)1110 3739 y(completions:)1110
|
||||
3898 y Fs(alias)240 b Ft(Alias)31 b(names.)41 b(Ma)m(y)31
|
||||
b(also)h(b)s(e)e(sp)s(eci\014ed)f(as)i(`)p Fs(-a)p Ft('.)1110
|
||||
4057 y Fs(arrayvar)96 b Ft(Arra)m(y)31 b(v)-5 b(ariable)31
|
||||
b(names.)1110 4216 y Fs(binding)144 b Ft(Readline)30
|
||||
b(k)m(ey)f(binding)f(names)h(\(see)h(Section)f(8.4)h([Bindable)1590
|
||||
4325 y(Readline)h(Commands],)f(page)h(97\).)1110 4484
|
||||
y Fs(builtin)144 b Ft(Names)21 b(of)g(shell)f(builtin)h(commands.)37
|
||||
b(Ma)m(y)21 b(also)h(b)s(e)e(sp)s(eci\014ed)1590 4594
|
||||
y(as)31 b(`)p Fs(-b)p Ft('.)1110 4753 y Fs(command)144
|
||||
3224 y Fs(nospace)144 b Ft(T)-8 b(ell)40 b(Readline)g(not)g(to)g(app)s
|
||||
(end)d(a)j(space)g(\(the)f(default\))h(to)1590 3333 y(w)m(ords)30
|
||||
b(completed)h(at)g(the)g(end)f(of)g(the)h(line.)1110
|
||||
3488 y Fs(plusdirs)96 b Ft(After)30 b(an)m(y)h(matc)m(hes)g(de\014ned)d
|
||||
(b)m(y)i(the)g(compsp)s(ec)g(are)g(gener-)1590 3598 y(ated,)g
|
||||
(directory)f(name)g(completion)i(is)d(attempted)i(and)f(an)m(y)1590
|
||||
3707 y(matc)m(hes)j(are)e(added)g(to)h(the)g(results)f(of)g(the)h
|
||||
(other)g(actions.)630 3862 y Fs(-A)f Fj(action)1110 3972
|
||||
y Ft(The)25 b Fq(action)h Ft(ma)m(y)g(b)s(e)e(one)h(of)h(the)f(follo)m
|
||||
(wing)i(to)e(generate)i(a)e(list)h(of)f(p)s(ossible)1110
|
||||
4082 y(completions:)1110 4237 y Fs(alias)240 b Ft(Alias)31
|
||||
b(names.)41 b(Ma)m(y)31 b(also)h(b)s(e)e(sp)s(eci\014ed)f(as)i(`)p
|
||||
Fs(-a)p Ft('.)1110 4391 y Fs(arrayvar)96 b Ft(Arra)m(y)31
|
||||
b(v)-5 b(ariable)31 b(names.)1110 4546 y Fs(binding)144
|
||||
b Ft(Readline)30 b(k)m(ey)f(binding)f(names)h(\(see)h(Section)f(8.4)h
|
||||
([Bindable)1590 4656 y(Readline)h(Commands],)f(page)h(97\).)1110
|
||||
4811 y Fs(builtin)144 b Ft(Names)21 b(of)g(shell)f(builtin)h(commands.)
|
||||
37 b(Ma)m(y)21 b(also)h(b)s(e)e(sp)s(eci\014ed)1590 4921
|
||||
y(as)31 b(`)p Fs(-b)p Ft('.)1110 5075 y Fs(command)144
|
||||
b Ft(Command)29 b(names.)41 b(Ma)m(y)32 b(also)f(b)s(e)f(sp)s
|
||||
(eci\014ed)f(as)i(`)p Fs(-c)p Ft('.)1110 4912 y Fs(directory)1590
|
||||
5022 y Ft(Directory)h(names.)40 b(Ma)m(y)32 b(also)f(b)s(e)f(sp)s
|
||||
(eci\014ed)g(as)g(`)p Fs(-d)p Ft('.)1110 5181 y Fs(disabled)96
|
||||
b Ft(Names)31 b(of)g(disabled)f(shell)g(builtins.)1110
|
||||
5340 y Fs(enabled)144 b Ft(Names)31 b(of)g(enabled)f(shell)g(builtins.)
|
||||
p eop end
|
||||
(eci\014ed)f(as)i(`)p Fs(-c)p Ft('.)1110 5230 y Fs(directory)1590
|
||||
5340 y Ft(Directory)h(names.)40 b(Ma)m(y)32 b(also)f(b)s(e)f(sp)s
|
||||
(eci\014ed)g(as)g(`)p Fs(-d)p Ft('.)p eop end
|
||||
%%Page: 109 115
|
||||
TeXDict begin 109 114 bop 150 -116 a Ft(Chapter)30 b(8:)41
|
||||
b(Command)29 b(Line)i(Editing)2062 b(109)1110 299 y Fs(export)192
|
||||
b Ft(Names)34 b(of)f(exp)s(orted)f(shell)h(v)-5 b(ariables.)49
|
||||
b(Ma)m(y)35 b(also)e(b)s(e)g(sp)s(eci-)1590 408 y(\014ed)d(as)g(`)p
|
||||
Fs(-e)p Ft('.)1110 558 y Fs(file)288 b Ft(File)32 b(names.)40
|
||||
b(Ma)m(y)32 b(also)f(b)s(e)f(sp)s(eci\014ed)f(as)i(`)p
|
||||
Fs(-f)p Ft('.)1110 708 y Fs(function)96 b Ft(Names)31
|
||||
b(of)g(shell)f(functions.)1110 858 y Fs(group)240 b Ft(Group)30
|
||||
b(names.)40 b(Ma)m(y)32 b(also)f(b)s(e)f(sp)s(eci\014ed)g(as)g(`)p
|
||||
Fs(-g)p Ft('.)1110 1008 y Fs(helptopic)1590 1118 y Ft(Help)37
|
||||
b(topics)g(as)g(accepted)h(b)m(y)e(the)h Fs(help)f Ft(builtin)g(\(see)h
|
||||
(Sec-)1590 1228 y(tion)31 b(4.2)g([Bash)g(Builtins],)g(page)g(39\).)
|
||||
1110 1377 y Fs(hostname)96 b Ft(Hostnames,)89 b(as)76
|
||||
b(tak)m(en)h(from)f(the)g(\014le)h(sp)s(eci\014ed)e(b)m(y)1590
|
||||
1487 y(the)55 b Fs(HOSTFILE)e Ft(shell)j(v)-5 b(ariable)56
|
||||
b(\(see)g(Section)g(5.2)h([Bash)1590 1597 y(V)-8 b(ariables],)32
|
||||
b(page)f(55\).)1110 1747 y Fs(job)336 b Ft(Job)31 b(names,)h(if)g(job)f
|
||||
(con)m(trol)i(is)f(activ)m(e.)46 b(Ma)m(y)33 b(also)g(b)s(e)e(sp)s
|
||||
(eci-)1590 1856 y(\014ed)f(as)g(`)p Fs(-j)p Ft('.)1110
|
||||
2006 y Fs(keyword)144 b Ft(Shell)30 b(reserv)m(ed)h(w)m(ords.)40
|
||||
b(Ma)m(y)32 b(also)f(b)s(e)f(sp)s(eci\014ed)f(as)i(`)p
|
||||
Fs(-k)p Ft('.)1110 2156 y Fs(running)144 b Ft(Names)31
|
||||
b(of)g(running)d(jobs,)i(if)h(job)f(con)m(trol)h(is)g(activ)m(e.)1110
|
||||
2306 y Fs(service)144 b Ft(Service)31 b(names.)41 b(Ma)m(y)31
|
||||
b(also)g(b)s(e)f(sp)s(eci\014ed)g(as)g(`)p Fs(-s)p Ft('.)1110
|
||||
2456 y Fs(setopt)192 b Ft(V)-8 b(alid)34 b(argumen)m(ts)f(for)f(the)h
|
||||
(`)p Fs(-o)p Ft(')g(option)g(to)h(the)f Fs(set)e Ft(builtin)1590
|
||||
2566 y(\(see)g(Section)h(4.3)f([The)f(Set)h(Builtin],)g(page)g(50\).)
|
||||
1110 2716 y Fs(shopt)240 b Ft(Shell)40 b(option)g(names)g(as)g
|
||||
b(Command)29 b(Line)i(Editing)2062 b(109)1110 299 y Fs(disabled)96
|
||||
b Ft(Names)31 b(of)g(disabled)f(shell)g(builtins.)1110
|
||||
458 y Fs(enabled)144 b Ft(Names)31 b(of)g(enabled)f(shell)g(builtins.)
|
||||
1110 617 y Fs(export)192 b Ft(Names)34 b(of)f(exp)s(orted)f(shell)h(v)
|
||||
-5 b(ariables.)49 b(Ma)m(y)35 b(also)e(b)s(e)g(sp)s(eci-)1590
|
||||
726 y(\014ed)d(as)g(`)p Fs(-e)p Ft('.)1110 885 y Fs(file)288
|
||||
b Ft(File)32 b(names.)40 b(Ma)m(y)32 b(also)f(b)s(e)f(sp)s(eci\014ed)f
|
||||
(as)i(`)p Fs(-f)p Ft('.)1110 1044 y Fs(function)96 b
|
||||
Ft(Names)31 b(of)g(shell)f(functions.)1110 1203 y Fs(group)240
|
||||
b Ft(Group)30 b(names.)40 b(Ma)m(y)32 b(also)f(b)s(e)f(sp)s(eci\014ed)g
|
||||
(as)g(`)p Fs(-g)p Ft('.)1110 1362 y Fs(helptopic)1590
|
||||
1471 y Ft(Help)37 b(topics)g(as)g(accepted)h(b)m(y)e(the)h
|
||||
Fs(help)f Ft(builtin)g(\(see)h(Sec-)1590 1581 y(tion)31
|
||||
b(4.2)g([Bash)g(Builtins],)g(page)g(39\).)1110 1740 y
|
||||
Fs(hostname)96 b Ft(Hostnames,)89 b(as)76 b(tak)m(en)h(from)f(the)g
|
||||
(\014le)h(sp)s(eci\014ed)e(b)m(y)1590 1850 y(the)55 b
|
||||
Fs(HOSTFILE)e Ft(shell)j(v)-5 b(ariable)56 b(\(see)g(Section)g(5.2)h
|
||||
([Bash)1590 1959 y(V)-8 b(ariables],)32 b(page)f(55\).)1110
|
||||
2118 y Fs(job)336 b Ft(Job)31 b(names,)h(if)g(job)f(con)m(trol)i(is)f
|
||||
(activ)m(e.)46 b(Ma)m(y)33 b(also)g(b)s(e)e(sp)s(eci-)1590
|
||||
2228 y(\014ed)f(as)g(`)p Fs(-j)p Ft('.)1110 2387 y Fs(keyword)144
|
||||
b Ft(Shell)30 b(reserv)m(ed)h(w)m(ords.)40 b(Ma)m(y)32
|
||||
b(also)f(b)s(e)f(sp)s(eci\014ed)f(as)i(`)p Fs(-k)p Ft('.)1110
|
||||
2545 y Fs(running)144 b Ft(Names)31 b(of)g(running)d(jobs,)i(if)h(job)f
|
||||
(con)m(trol)h(is)g(activ)m(e.)1110 2704 y Fs(service)144
|
||||
b Ft(Service)31 b(names.)41 b(Ma)m(y)31 b(also)g(b)s(e)f(sp)s
|
||||
(eci\014ed)g(as)g(`)p Fs(-s)p Ft('.)1110 2863 y Fs(setopt)192
|
||||
b Ft(V)-8 b(alid)34 b(argumen)m(ts)f(for)f(the)h(`)p
|
||||
Fs(-o)p Ft(')g(option)g(to)h(the)f Fs(set)e Ft(builtin)1590
|
||||
2973 y(\(see)g(Section)h(4.3)f([The)f(Set)h(Builtin],)g(page)g(50\).)
|
||||
1110 3132 y Fs(shopt)240 b Ft(Shell)40 b(option)g(names)g(as)g
|
||||
(accepted)i(b)m(y)e(the)g Fs(shopt)e Ft(builtin)1590
|
||||
2825 y(\(see)31 b(Section)h(4.2)f([Bash)g(Builtins],)g(page)g(39\).)
|
||||
1110 2975 y Fs(signal)192 b Ft(Signal)31 b(names.)1110
|
||||
3125 y Fs(stopped)144 b Ft(Names)31 b(of)g(stopp)s(ed)e(jobs,)h(if)g
|
||||
(job)g(con)m(trol)i(is)f(activ)m(e.)1110 3275 y Fs(user)288
|
||||
3241 y(\(see)31 b(Section)h(4.2)f([Bash)g(Builtins],)g(page)g(39\).)
|
||||
1110 3400 y Fs(signal)192 b Ft(Signal)31 b(names.)1110
|
||||
3559 y Fs(stopped)144 b Ft(Names)31 b(of)g(stopp)s(ed)e(jobs,)h(if)g
|
||||
(job)g(con)m(trol)i(is)f(activ)m(e.)1110 3718 y Fs(user)288
|
||||
b Ft(User)30 b(names.)41 b(Ma)m(y)32 b(also)f(b)s(e)f(sp)s(eci\014ed)f
|
||||
(as)i(`)p Fs(-u)p Ft('.)1110 3425 y Fs(variable)96 b
|
||||
(as)i(`)p Fs(-u)p Ft('.)1110 3877 y Fs(variable)96 b
|
||||
Ft(Names)36 b(of)g(all)g(shell)g(v)-5 b(ariables.)56
|
||||
b(Ma)m(y)37 b(also)f(b)s(e)f(sp)s(eci\014ed)g(as)1590
|
||||
3535 y(`)p Fs(-v)p Ft('.)630 3685 y Fs(-G)30 b Fj(globpat)1110
|
||||
3794 y Ft(The)39 b(\014lename)h(expansion)g(pattern)g
|
||||
Fq(globpat)j Ft(is)d(expanded)f(to)h(generate)1110 3904
|
||||
y(the)31 b(p)s(ossible)e(completions.)630 4054 y Fs(-W)h
|
||||
Fj(wordlist)1110 4163 y Ft(The)24 b Fq(w)m(ordlist)k
|
||||
3987 y(`)p Fs(-v)p Ft('.)630 4145 y Fs(-G)30 b Fj(globpat)1110
|
||||
4255 y Ft(The)39 b(\014lename)h(expansion)g(pattern)g
|
||||
Fq(globpat)j Ft(is)d(expanded)f(to)h(generate)1110 4365
|
||||
y(the)31 b(p)s(ossible)e(completions.)630 4524 y Fs(-W)h
|
||||
Fj(wordlist)1110 4633 y Ft(The)24 b Fq(w)m(ordlist)k
|
||||
Ft(is)d(split)g(using)f(the)h(c)m(haracters)i(in)d(the)i
|
||||
Fs(IFS)e Ft(sp)s(ecial)h(v)-5 b(ariable)1110 4273 y(as)36
|
||||
Fs(IFS)e Ft(sp)s(ecial)h(v)-5 b(ariable)1110 4743 y(as)36
|
||||
b(delimiters,)i(and)e(eac)m(h)h(resultan)m(t)g(w)m(ord)e(is)h
|
||||
(expanded.)57 b(The)35 b(p)s(ossible)1110 4383 y(completions)c(are)e
|
||||
(expanded.)57 b(The)35 b(p)s(ossible)1110 4852 y(completions)c(are)e
|
||||
(the)h(mem)m(b)s(ers)f(of)g(the)h(resultan)m(t)g(list)g(whic)m(h)f
|
||||
(matc)m(h)i(the)1110 4492 y(w)m(ord)f(b)s(eing)g(completed.)630
|
||||
4642 y Fs(-C)g Fj(command)1110 4752 y Fq(command)35 b
|
||||
(matc)m(h)i(the)1110 4962 y(w)m(ord)f(b)s(eing)g(completed.)630
|
||||
5121 y Fs(-C)g Fj(command)1110 5230 y Fq(command)35 b
|
||||
Ft(is)e(executed)g(in)e(a)i(subshell)e(en)m(vironmen)m(t,)i(and)f(its)g
|
||||
(output)g(is)1110 4861 y(used)e(as)g(the)h(p)s(ossible)f(completions.)
|
||||
630 5011 y Fs(-F)g Fj(function)1110 5121 y Ft(The)25
|
||||
b(shell)i(function)e Fq(function)h Ft(is)g(executed)h(in)e(the)i
|
||||
(curren)m(t)e(shell)i(en)m(viron-)1110 5230 y(men)m(t.)40
|
||||
b(When)25 b(it)h(\014nishes,)f(the)h(p)s(ossible)f(completions)h(are)g
|
||||
(retriev)m(ed)g(from)1110 5340 y(the)31 b(v)-5 b(alue)30
|
||||
b(of)h(the)g Fs(COMPREPLY)c Ft(arra)m(y)k(v)-5 b(ariable.)p
|
||||
(output)g(is)1110 5340 y(used)e(as)g(the)h(p)s(ossible)f(completions.)p
|
||||
eop end
|
||||
%%Page: 110 116
|
||||
TeXDict begin 110 115 bop 150 -116 a Ft(110)2527 b(Bash)31
|
||||
b(Reference)g(Man)m(ual)630 299 y Fs(-X)f Fj(filterpat)1110
|
||||
408 y Fq(\014lterpat)d Ft(is)e(a)g(pattern)g(as)f(used)g(for)h
|
||||
(\014lename)g(expansion.)38 b(It)25 b(is)g(applied)f(to)1110
|
||||
518 y(the)30 b(list)f(of)h(p)s(ossible)f(completions)h(generated)h(b)m
|
||||
(y)e(the)g(preceding)h(options)1110 628 y(and)d(argumen)m(ts,)i(and)e
|
||||
(eac)m(h)i(completion)g(matc)m(hing)g Fq(\014lterpat)h
|
||||
Ft(is)e(remo)m(v)m(ed)1110 737 y(from)i(the)h(list.)42
|
||||
b(A)30 b(leading)i(`)p Fs(!)p Ft(')e(in)g Fq(\014lterpat)j
|
||||
Ft(negates)f(the)f(pattern;)g(in)f(this)1110 847 y(case,)i(an)m(y)e
|
||||
(completion)i(not)f(matc)m(hing)g Fq(\014lterpat)i Ft(is)d(remo)m(v)m
|
||||
(ed.)630 1006 y Fs(-P)g Fj(prefix)1110 1116 y Fq(pre\014x)39
|
||||
b Ft(is)34 b(added)f(at)i(the)f(b)s(eginning)f(of)i(eac)m(h)g(p)s
|
||||
(ossible)e(completion)i(after)1110 1225 y(all)c(other)g(options)g(ha)m
|
||||
(v)m(e)g(b)s(een)f(applied.)630 1385 y Fs(-S)g Fj(suffix)1110
|
||||
1494 y Fq(su\016x)c Ft(is)20 b(app)s(ended)f(to)i(eac)m(h)h(p)s
|
||||
(ossible)e(completion)i(after)f(all)g(other)g(options)1110
|
||||
1604 y(ha)m(v)m(e)32 b(b)s(een)d(applied.)630 1763 y(The)35
|
||||
b(return)g(v)-5 b(alue)37 b(is)f(true)f(unless)h(an)f(in)m(v)-5
|
||||
b(alid)37 b(option)f(is)g(supplied,)g(an)g(option)h(other)630
|
||||
1873 y(than)31 b(`)p Fs(-p)p Ft(')g(or)g(`)p Fs(-r)p
|
||||
b(Reference)g(Man)m(ual)630 299 y Fs(-F)f Fj(function)1110
|
||||
408 y Ft(The)25 b(shell)i(function)e Fq(function)h Ft(is)g(executed)h
|
||||
(in)e(the)i(curren)m(t)e(shell)i(en)m(viron-)1110 518
|
||||
y(men)m(t.)40 b(When)25 b(it)h(\014nishes,)f(the)h(p)s(ossible)f
|
||||
(completions)h(are)g(retriev)m(ed)g(from)1110 628 y(the)31
|
||||
b(v)-5 b(alue)30 b(of)h(the)g Fs(COMPREPLY)c Ft(arra)m(y)k(v)-5
|
||||
b(ariable.)630 787 y Fs(-X)30 b Fj(filterpat)1110 897
|
||||
y Fq(\014lterpat)d Ft(is)e(a)g(pattern)g(as)f(used)g(for)h(\014lename)g
|
||||
(expansion.)38 b(It)25 b(is)g(applied)f(to)1110 1006
|
||||
y(the)30 b(list)f(of)h(p)s(ossible)f(completions)h(generated)h(b)m(y)e
|
||||
(the)g(preceding)h(options)1110 1116 y(and)d(argumen)m(ts,)i(and)e(eac)
|
||||
m(h)i(completion)g(matc)m(hing)g Fq(\014lterpat)h Ft(is)e(remo)m(v)m
|
||||
(ed)1110 1225 y(from)i(the)h(list.)42 b(A)30 b(leading)i(`)p
|
||||
Fs(!)p Ft(')e(in)g Fq(\014lterpat)j Ft(negates)f(the)f(pattern;)g(in)f
|
||||
(this)1110 1335 y(case,)i(an)m(y)e(completion)i(not)f(matc)m(hing)g
|
||||
Fq(\014lterpat)i Ft(is)d(remo)m(v)m(ed.)630 1494 y Fs(-P)g
|
||||
Fj(prefix)1110 1604 y Fq(pre\014x)39 b Ft(is)34 b(added)f(at)i(the)f(b)
|
||||
s(eginning)f(of)i(eac)m(h)g(p)s(ossible)e(completion)i(after)1110
|
||||
1714 y(all)c(other)g(options)g(ha)m(v)m(e)g(b)s(een)f(applied.)630
|
||||
1873 y Fs(-S)g Fj(suffix)1110 1983 y Fq(su\016x)c Ft(is)20
|
||||
b(app)s(ended)f(to)i(eac)m(h)h(p)s(ossible)e(completion)i(after)f(all)g
|
||||
(other)g(options)1110 2092 y(ha)m(v)m(e)32 b(b)s(een)d(applied.)630
|
||||
2252 y(The)35 b(return)g(v)-5 b(alue)37 b(is)f(true)f(unless)h(an)f(in)
|
||||
m(v)-5 b(alid)37 b(option)f(is)g(supplied,)g(an)g(option)h(other)630
|
||||
2361 y(than)31 b(`)p Fs(-p)p Ft(')g(or)g(`)p Fs(-r)p
|
||||
Ft(')g(is)g(supplied)f(without)h(a)g Fq(name)37 b Ft(argumen)m(t,)32
|
||||
b(an)f(attempt)h(is)f(made)g(to)630 1983 y(remo)m(v)m(e)h(a)e
|
||||
b(an)f(attempt)h(is)f(made)g(to)630 2471 y(remo)m(v)m(e)h(a)e
|
||||
(completion)i(sp)s(eci\014cation)f(for)f(a)h Fq(name)k
|
||||
Ft(for)30 b(whic)m(h)g(no)g(sp)s(eci\014cation)h(exists,)630
|
||||
2092 y(or)f(an)h(error)f(o)s(ccurs)g(adding)g(a)g(completion)i(sp)s
|
||||
2580 y(or)f(an)h(error)f(o)s(ccurs)g(adding)g(a)g(completion)i(sp)s
|
||||
(eci\014cation.)p eop end
|
||||
%%Page: 111 117
|
||||
TeXDict begin 111 116 bop 150 -116 a Ft(Chapter)30 b(9:)41
|
||||
|
||||
+2
-2
@@ -4787,7 +4787,7 @@ option).
|
||||
|
||||
@item --dump-po-strings
|
||||
A list of all double-quoted strings preceded by @samp{$}
|
||||
is printed on the standard ouput
|
||||
is printed on the standard output
|
||||
in the @sc{gnu} @code{gettext} PO (portable object) file format.
|
||||
Equivalent to @option{-D} except for the output format.
|
||||
|
||||
@@ -4874,7 +4874,7 @@ when invoking an interactive shell.
|
||||
|
||||
@item -D
|
||||
A list of all double-quoted strings preceded by @samp{$}
|
||||
is printed on the standard ouput.
|
||||
is printed on the standard output.
|
||||
These are the strings that
|
||||
are subject to language translation when the current locale
|
||||
is not @code{C} or @code{POSIX} (@pxref{Locale Translation}).
|
||||
|
||||
+2
-2
@@ -4278,8 +4278,8 @@ The command argument to the @option{-c} invocation option.
|
||||
An array variable whose members are the line numbers in source files
|
||||
corresponding to each member of @var{FUNCNAME}.
|
||||
@code{$@{BASH_LINENO[$i]@}} is the line number in the source file where
|
||||
@code{$@{FUNCNAME[$i + 1]@}} was called.
|
||||
The corresponding source file name is @code{$@{BASH_SOURCE[$i + 1]@}}.
|
||||
@code{$@{FUNCNAME[$i]@}} was called.
|
||||
The corresponding source file name is @code{$@{BASH_SOURCE[$i]@}}.
|
||||
Use @code{LINENO} to obtain the current line number.
|
||||
|
||||
@item BASH_REMATCH
|
||||
|
||||
+542
-537
File diff suppressed because it is too large
Load Diff
+245
-241
@@ -1,6 +1,6 @@
|
||||
%!PS-Adobe-3.0
|
||||
%%Creator: groff version 1.18.1
|
||||
%%CreationDate: Mon Aug 30 08:27:13 2004
|
||||
%%CreationDate: Tue Sep 21 11:57:03 2004
|
||||
%%DocumentNeededResources: font Times-Roman
|
||||
%%+ font Times-Bold
|
||||
%%+ font Times-Italic
|
||||
@@ -564,359 +564,363 @@ F(ing trailing spaces\).)224 597.6 Q
|
||||
(Intended to be used with shell functions.)5 E F2(nospace)184 609.6 Q F0
|
||||
-.7(Te)6.11 G .22(ll readline not to append a space \(the def).7 F .22
|
||||
(ault\) to w)-.1 F .22(ords completed at the end)-.1 F(of the line.)224
|
||||
621.6 Q F2<ad41>144 633.6 Q F1(action)2.5 E F0(The)184 645.6 Q F1
|
||||
621.6 Q F2(plusdirs)184 633.6 Q F0 1.985(After an)5.54 F 4.485(ym)-.15 G
|
||||
1.985(atches de\214ned by the compspec are generated, directory name)
|
||||
-4.485 F .584(completion is attempted and an)224 645.6 R 3.084(ym)-.15 G
|
||||
.584(atches are added to the results of the other)-3.084 F(actions.)224
|
||||
657.6 Q F2<ad41>144 669.6 Q F1(action)2.5 E F0(The)184 681.6 Q F1
|
||||
(action)2.5 E F0(may be one of the follo)2.5 E
|
||||
(wing to generate a list of possible completions:)-.25 E F2(alias)184
|
||||
657.6 Q F0(Alias names.)20.55 E(May also be speci\214ed as)5 E F2<ad61>
|
||||
2.5 E F0(.)A F2(arrayv)184 669.6 Q(ar)-.1 E F0(Array v)224 681.6 Q
|
||||
(ariable names.)-.25 E F2 4.7(binding Readline)184 693.6 R F0 -.1(ke)2.5
|
||||
G 2.5(yb)-.05 G(inding names.)-2.5 E F2 -.2(bu)184 705.6 S(iltin).2 E F0
|
||||
(Names of shell b)11.85 E(uiltin commands.)-.2 E
|
||||
(May also be speci\214ed as)5 E F2<ad62>2.5 E F0(.)A(GNU Bash-3.0)72 768
|
||||
Q(2004 Apr 20)148.735 E(3)203.725 E 0 Cg EP
|
||||
693.6 Q F0(Alias names.)20.55 E(May also be speci\214ed as)5 E F2<ad61>
|
||||
2.5 E F0(.)A F2(arrayv)184 705.6 Q(ar)-.1 E F0(Array v)224 717.6 Q
|
||||
(ariable names.)-.25 E(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
|
||||
%%EndPageSetup
|
||||
/F0 10/Times-Roman@0 SF -.35(BA)72 48 S(SH_B).35 E(UIL)-.1 E 290.48
|
||||
(TINS\(1\) B)-.92 F(ASH_B)-.35 E(UIL)-.1 E(TINS\(1\))-.92 E/F1 10
|
||||
/Times-Bold@0 SF(command)184 84 Q F0(Command names.)224 96 Q
|
||||
(May also be speci\214ed as)5 E F1<ad63>2.5 E F0(.)A F1(dir)184 108 Q
|
||||
(ectory)-.18 E F0(Directory names.)224 120 Q(May also be speci\214ed as)
|
||||
5 E F1<ad64>2.5 E F0(.)A F1(disabled)184 132 Q F0
|
||||
(Names of disabled shell b)224 144 Q(uiltins.)-.2 E F1(enabled)184 156 Q
|
||||
F0(Names of enabled shell b)6.66 E(uiltins.)-.2 E F1(export)184 168 Q F0
|
||||
(Names of e)12.23 E(xported shell v)-.15 E 2.5(ariables. May)-.25 F
|
||||
(also be speci\214ed as)2.5 E F1<ad65>2.5 E F0(.)A F1(\214le)184 180 Q
|
||||
F0(File names.)27.22 E(May also be speci\214ed as)5 E F1<ad66>2.5 E F0
|
||||
(.)A F1(function)184 192 Q F0(Names of shell functions.)224 204 Q F1(gr)
|
||||
184 216 Q(oup)-.18 E F0(Group names.)14.62 E(May also be speci\214ed as)
|
||||
5 E F1<ad67>2.5 E F0(.)A F1(helptopic)184 228 Q F0
|
||||
(Help topics as accepted by the)224 240 Q F1(help)2.5 E F0 -.2(bu)2.5 G
|
||||
(iltin.).2 E F1(hostname)184 252 Q F0(Hostnames, as tak)224 264 Q
|
||||
(en from the \214le speci\214ed by the)-.1 E/F2 9/Times-Bold@0 SF
|
||||
(HOSTFILE)2.5 E F0(shell v)2.25 E(ariable.)-.25 E F1(job)184 276 Q F0
|
||||
/Times-Bold@0 SF 4.7(binding Readline)184 84 R F0 -.1(ke)2.5 G 2.5(yb)
|
||||
-.05 G(inding names.)-2.5 E F1 -.2(bu)184 96 S(iltin).2 E F0
|
||||
(Names of shell b)11.85 E(uiltin commands.)-.2 E
|
||||
(May also be speci\214ed as)5 E F1<ad62>2.5 E F0(.)A F1(command)184 108
|
||||
Q F0(Command names.)224 120 Q(May also be speci\214ed as)5 E F1<ad63>2.5
|
||||
E F0(.)A F1(dir)184 132 Q(ectory)-.18 E F0(Directory names.)224 144 Q
|
||||
(May also be speci\214ed as)5 E F1<ad64>2.5 E F0(.)A F1(disabled)184 156
|
||||
Q F0(Names of disabled shell b)224 168 Q(uiltins.)-.2 E F1(enabled)184
|
||||
180 Q F0(Names of enabled shell b)6.66 E(uiltins.)-.2 E F1(export)184
|
||||
192 Q F0(Names of e)12.23 E(xported shell v)-.15 E 2.5(ariables. May)
|
||||
-.25 F(also be speci\214ed as)2.5 E F1<ad65>2.5 E F0(.)A F1(\214le)184
|
||||
204 Q F0(File names.)27.22 E(May also be speci\214ed as)5 E F1<ad66>2.5
|
||||
E F0(.)A F1(function)184 216 Q F0(Names of shell functions.)224 228 Q F1
|
||||
(gr)184 240 Q(oup)-.18 E F0(Group names.)14.62 E
|
||||
(May also be speci\214ed as)5 E F1<ad67>2.5 E F0(.)A F1(helptopic)184
|
||||
252 Q F0(Help topics as accepted by the)224 264 Q F1(help)2.5 E F0 -.2
|
||||
(bu)2.5 G(iltin.).2 E F1(hostname)184 276 Q F0(Hostnames, as tak)224 288
|
||||
Q(en from the \214le speci\214ed by the)-.1 E/F2 9/Times-Bold@0 SF
|
||||
(HOSTFILE)2.5 E F0(shell v)2.25 E(ariable.)-.25 E F1(job)184 300 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 F1 -.1(ke)184 288 S
|
||||
(yw).1 E(ord)-.1 E F0(Shell reserv)224 300 Q(ed w)-.15 E 2.5(ords. May)
|
||||
(ay also be speci\214ed as)-5 E F1<ad6a>2.5 E F0(.)A F1 -.1(ke)184 312 S
|
||||
(yw).1 E(ord)-.1 E F0(Shell reserv)224 324 Q(ed w)-.15 E 2.5(ords. May)
|
||||
-.1 F(also be speci\214ed as)2.5 E F1<ad6b>2.5 E F0(.)A F1(running)184
|
||||
312 Q F0(Names of running jobs, if job control is acti)5.54 E -.15(ve)
|
||||
-.25 G(.).15 E F1(ser)184 324 Q(vice)-.1 E F0(Service names.)10.67 E
|
||||
(May also be speci\214ed as)5 E F1<ad73>2.5 E F0(.)A F1(setopt)184 336 Q
|
||||
336 Q F0(Names of running jobs, if job control is acti)5.54 E -.15(ve)
|
||||
-.25 G(.).15 E F1(ser)184 348 Q(vice)-.1 E F0(Service names.)10.67 E
|
||||
(May also be speci\214ed as)5 E F1<ad73>2.5 E F0(.)A F1(setopt)184 360 Q
|
||||
F0 -1.11(Va)14.45 G(lid ar)1.11 E(guments for the)-.18 E F1<ad6f>2.5 E
|
||||
F0(option to the)2.5 E F1(set)2.5 E F0 -.2(bu)2.5 G(iltin.).2 E F1
|
||||
(shopt)184 348 Q F0(Shell option names as accepted by the)16.66 E F1
|
||||
(shopt)2.5 E F0 -.2(bu)2.5 G(iltin.).2 E F1(signal)184 360 Q F0
|
||||
(Signal names.)14.99 E F1(stopped)184 372 Q F0
|
||||
(shopt)184 372 Q F0(Shell option names as accepted by the)16.66 E F1
|
||||
(shopt)2.5 E F0 -.2(bu)2.5 G(iltin.).2 E F1(signal)184 384 Q F0
|
||||
(Signal names.)14.99 E F1(stopped)184 396 Q F0
|
||||
(Names of stopped jobs, if job control is acti)6.66 E -.15(ve)-.25 G(.)
|
||||
.15 E F1(user)184 384 Q F0(User names.)21.67 E
|
||||
(May also be speci\214ed as)5 E F1<ad75>2.5 E F0(.)A F1 -.1(va)184 396 S
|
||||
.15 E F1(user)184 408 Q F0(User names.)21.67 E
|
||||
(May also be speci\214ed as)5 E F1<ad75>2.5 E F0(.)A F1 -.1(va)184 420 S
|
||||
(riable).1 E F0(Names of all shell v)5.1 E 2.5(ariables. May)-.25 F
|
||||
(also be speci\214ed as)2.5 E F1<ad76>2.5 E F0(.)A F1<ad47>144 408 Q/F3
|
||||
10/Times-Italic@0 SF(globpat)2.5 E F0 1.41(The \214lename e)184 420 R
|
||||
(also be speci\214ed as)2.5 E F1<ad76>2.5 E F0(.)A F1<ad47>144 432 Q/F3
|
||||
10/Times-Italic@0 SF(globpat)2.5 E F0 1.41(The \214lename e)184 444 R
|
||||
1.411(xpansion pattern)-.15 F F3(globpat)3.911 E F0 1.411(is e)3.911 F
|
||||
1.411(xpanded to generate the possible comple-)-.15 F(tions.)184 432 Q
|
||||
F1<ad57>144 444 Q F3(wor)2.5 E(dlist)-.37 E F0(The)184 456 Q F3(wor)3.64
|
||||
1.411(xpanded to generate the possible comple-)-.15 F(tions.)184 456 Q
|
||||
F1<ad57>144 468 Q F3(wor)2.5 E(dlist)-.37 E F0(The)184 480 Q F3(wor)3.64
|
||||
E(dlist)-.37 E F0 1.14(is split using the characters in the)3.64 F F2
|
||||
(IFS)3.64 E F0 1.139(special v)3.39 F 1.139(ariable as delimiters, and)
|
||||
-.25 F 2.007(each resultant w)184 468 R 2.007(ord is e)-.1 F 4.507
|
||||
-.25 F 2.007(each resultant w)184 492 R 2.007(ord is e)-.1 F 4.507
|
||||
(xpanded. The)-.15 F 2.008(possible completions are the members of the)
|
||||
4.507 F(resultant list which match the w)184 480 Q(ord being completed.)
|
||||
-.1 E F1<ad43>144 492 Q F3(command)2.5 E(command)184 504 Q F0 1.056
|
||||
4.507 F(resultant list which match the w)184 504 Q(ord being completed.)
|
||||
-.1 E F1<ad43>144 516 Q F3(command)2.5 E(command)184 528 Q F0 1.056
|
||||
(is e)3.556 F -.15(xe)-.15 G 1.056(cuted in a subshell en).15 F 1.056
|
||||
(vironment, and its output is used as the possible)-.4 F(completions.)
|
||||
184 516 Q F1<ad46>144 528 Q F3(function)2.5 E F0 1.18
|
||||
(The shell function)184 540 R F3(function)3.68 E F0 1.181(is e)3.681 F
|
||||
184 540 Q F1<ad46>144 552 Q F3(function)2.5 E F0 1.18
|
||||
(The shell function)184 564 R F3(function)3.68 E F0 1.181(is e)3.681 F
|
||||
-.15(xe)-.15 G 1.181(cuted in the current shell en).15 F 3.681
|
||||
(vironment. When)-.4 F 1.181(it \214n-)3.681 F .932
|
||||
(ishes, the possible completions are retrie)184 552 R -.15(ve)-.25 G
|
||||
(ishes, the possible completions are retrie)184 576 R -.15(ve)-.25 G
|
||||
3.432(df).15 G .932(rom the v)-3.432 F .932(alue of the)-.25 F F2
|
||||
(COMPREPL)3.431 E(Y)-.828 E F0(array)3.181 E -.25(va)184 564 S(riable.)
|
||||
.25 E F1<ad58>144 576 Q F3(\214lterpat)2.5 E(\214lterpat)184 588 Q F0
|
||||
(COMPREPL)3.431 E(Y)-.828 E F0(array)3.181 E -.25(va)184 588 S(riable.)
|
||||
.25 E F1<ad58>144 600 Q F3(\214lterpat)2.5 E(\214lterpat)184 612 Q F0
|
||||
.733(is a pattern as used for \214lename e)3.233 F 3.233(xpansion. It)
|
||||
-.15 F .733(is applied to the list of possible)3.233 F 1.596
|
||||
(completions generated by the preceding options and ar)184 600 R 1.596
|
||||
(guments, and each completion)-.18 F(matching)184 612 Q F3(\214lterpat)
|
||||
(completions generated by the preceding options and ar)184 624 R 1.596
|
||||
(guments, and each completion)-.18 F(matching)184 636 Q F3(\214lterpat)
|
||||
3.204 E F0 .704(is remo)3.204 F -.15(ve)-.15 G 3.204(df).15 G .704
|
||||
(rom the list.)-3.204 F 3.204(Al)5.704 G(eading)-3.204 E F1(!)3.204 E F0
|
||||
(in)3.204 E F3(\214lterpat)3.205 E F0(ne)3.205 E -.05(ga)-.15 G .705
|
||||
(tes the pattern;).05 F(in this case, an)184 624 Q 2.5(yc)-.15 G
|
||||
(tes the pattern;).05 F(in this case, an)184 648 Q 2.5(yc)-.15 G
|
||||
(ompletion not matching)-2.5 E F3(\214lterpat)2.5 E F0(is remo)2.5 E
|
||||
-.15(ve)-.15 G(d.).15 E F1<ad50>144 636 Q F3(pr)2.5 E(e\214x)-.37 E(pr)
|
||||
184 648 Q(e\214x)-.37 E F0 .535(is added at the be)3.035 F .534
|
||||
-.15(ve)-.15 G(d.).15 E F1<ad50>144 660 Q F3(pr)2.5 E(e\214x)-.37 E(pr)
|
||||
184 672 Q(e\214x)-.37 E F0 .535(is added at the be)3.035 F .534
|
||||
(ginning of each possible completion after all other options ha)-.15 F
|
||||
-.15(ve)-.2 G(been applied.)184 660 Q F1<ad53>144 672 Q F3(suf)2.5 E
|
||||
-.15(ve)-.2 G(been applied.)184 684 Q F1<ad53>144 696 Q F3(suf)2.5 E
|
||||
2.81(\214x suf)-.18 F<8c78>-.18 E F0
|
||||
(is appended to each possible completion after all other options ha)2.5
|
||||
E .3 -.15(ve b)-.2 H(een applied.).15 E .466(The return v)144 688.8 R
|
||||
E .3 -.15(ve b)-.2 H(een applied.).15 E .466(The return v)144 712.8 R
|
||||
.466(alue is true unless an in)-.25 F -.25(va)-.4 G .466
|
||||
(lid option is supplied, an option other than).25 F F1<ad70>2.967 E F0
|
||||
(or)2.967 E F1<ad72>2.967 E F0 .467(is sup-)2.967 F 1.362
|
||||
(plied without a)144 700.8 R F3(name)3.862 E F0(ar)3.862 E 1.361
|
||||
(plied without a)144 724.8 R F3(name)3.862 E F0(ar)3.862 E 1.361
|
||||
(gument, an attempt is made to remo)-.18 F 1.661 -.15(ve a c)-.15 H
|
||||
1.361(ompletion speci\214cation for a).15 F F3(name)144 712.8 Q F0
|
||||
(for which no speci\214cation e)2.5 E
|
||||
(xists, or an error occurs adding a completion speci\214cation.)-.15 E
|
||||
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(4)203.725 E 0 Cg EP
|
||||
1.361(ompletion speci\214cation for a).15 F(GNU Bash-3.0)72 768 Q
|
||||
(2004 Apr 20)148.735 E(4)203.725 E 0 Cg EP
|
||||
%%Page: 5 5
|
||||
%%BeginPageSetup
|
||||
BP
|
||||
%%EndPageSetup
|
||||
/F0 10/Times-Roman@0 SF -.35(BA)72 48 S(SH_B).35 E(UIL)-.1 E 290.48
|
||||
(TINS\(1\) B)-.92 F(ASH_B)-.35 E(UIL)-.1 E(TINS\(1\))-.92 E/F1 10
|
||||
/Times-Bold@0 SF(continue)108 84 Q F0([)2.5 E/F2 10/Times-Italic@0 SF(n)
|
||||
A F0(])A 1.753(Resume the ne)144 96 R 1.753
|
||||
(xt iteration of the enclosing)-.15 F F1 -.25(fo)4.254 G(r).25 E F0(,)A
|
||||
F1(while)4.254 E F0(,)A F1(until)4.254 E F0 4.254(,o)C(r)-4.254 E F1
|
||||
(select)4.254 E F0 4.254(loop. If)4.254 F F2(n)4.614 E F0 1.754
|
||||
(is speci\214ed,)4.494 F 1.209(resume at the)144 108 R F2(n)3.709 E F0
|
||||
1.209(th enclosing loop.)B F2(n)6.569 E F0 1.209(must be)3.949 F/F3 10
|
||||
/Symbol SF<b3>3.709 E F0 3.709(1. If)3.709 F F2(n)4.069 E F0 1.209
|
||||
/Times-Italic@0 SF(name)144 84 Q F0(for which no speci\214cation e)2.5 E
|
||||
(xists, or an error occurs adding a completion speci\214cation.)-.15 E
|
||||
/F2 10/Times-Bold@0 SF(continue)108 100.8 Q F0([)2.5 E F1(n)A F0(])A
|
||||
1.753(Resume the ne)144 112.8 R 1.753(xt iteration of the enclosing)-.15
|
||||
F F2 -.25(fo)4.254 G(r).25 E F0(,)A F2(while)4.254 E F0(,)A F2(until)
|
||||
4.254 E F0 4.254(,o)C(r)-4.254 E F2(select)4.254 E F0 4.254(loop. If)
|
||||
4.254 F F1(n)4.614 E F0 1.754(is speci\214ed,)4.494 F 1.209
|
||||
(resume at the)144 124.8 R F1(n)3.709 E F0 1.209(th enclosing loop.)B F1
|
||||
(n)6.569 E F0 1.209(must be)3.949 F/F3 10/Symbol SF<b3>3.709 E F0 3.709
|
||||
(1. If)3.709 F F1(n)4.069 E F0 1.209
|
||||
(is greater than the number of enclosing)3.949 F .667
|
||||
(loops, the last enclosing loop \(the `)144 120 R(`top-le)-.74 E -.15
|
||||
(loops, the last enclosing loop \(the `)144 136.8 R(`top-le)-.74 E -.15
|
||||
(ve)-.25 G(l').15 E 3.167('l)-.74 G .667(oop\) is resumed.)-3.167 F .668
|
||||
(The return v)5.668 F .668(alue is 0 unless the)-.25 F(shell is not e)
|
||||
144 132 Q -.15(xe)-.15 G(cuting a loop when).15 E F1(continue)2.5 E F0
|
||||
(is e)2.5 E -.15(xe)-.15 G(cuted.).15 E F1(declar)108 148.8 Q(e)-.18 E
|
||||
F0([)2.5 E F1(\255afFirtx)A F0 2.5(][)C F1<ad70>-2.5 E F0 2.5(][)C F2
|
||||
(name)-2.5 E F0([=)A F2(value)A F0 2.5(].)C(..])-2.5 E F1(typeset)108
|
||||
160.8 Q F0([)2.5 E F1(\255afFirtx)A F0 2.5(][)C F1<ad70>-2.5 E F0 2.5
|
||||
(][)C F2(name)-2.5 E F0([=)A F2(value)A F0 2.5(].)C(..])-2.5 E 1.265
|
||||
(Declare v)144 172.8 R 1.265(ariables and/or gi)-.25 F 1.565 -.15(ve t)
|
||||
-.25 H 1.265(hem attrib).15 F 3.765(utes. If)-.2 F(no)3.765 E F2(name)
|
||||
144 148.8 Q -.15(xe)-.15 G(cuting a loop when).15 E F2(continue)2.5 E F0
|
||||
(is e)2.5 E -.15(xe)-.15 G(cuted.).15 E F2(declar)108 165.6 Q(e)-.18 E
|
||||
F0([)2.5 E F2(\255afFirtx)A F0 2.5(][)C F2<ad70>-2.5 E F0 2.5(][)C F1
|
||||
(name)-2.5 E F0([=)A F1(value)A F0 2.5(].)C(..])-2.5 E F2(typeset)108
|
||||
177.6 Q F0([)2.5 E F2(\255afFirtx)A F0 2.5(][)C F2<ad70>-2.5 E F0 2.5
|
||||
(][)C F1(name)-2.5 E F0([=)A F1(value)A F0 2.5(].)C(..])-2.5 E 1.265
|
||||
(Declare v)144 189.6 R 1.265(ariables and/or gi)-.25 F 1.565 -.15(ve t)
|
||||
-.25 H 1.265(hem attrib).15 F 3.765(utes. If)-.2 F(no)3.765 E F1(name)
|
||||
3.765 E F0 3.765(sa)C 1.265(re gi)-3.765 F -.15(ve)-.25 G 3.764(nt).15 G
|
||||
1.264(hen display the v)-3.764 F 1.264(alues of)-.25 F -.25(va)144 184.8
|
||||
S 3.326(riables. The).25 F F1<ad70>3.326 E F0 .826
|
||||
1.264(hen display the v)-3.764 F 1.264(alues of)-.25 F -.25(va)144 201.6
|
||||
S 3.326(riables. The).25 F F2<ad70>3.326 E F0 .826
|
||||
(option will display the attrib)3.326 F .826(utes and v)-.2 F .826
|
||||
(alues of each)-.25 F F2(name)3.326 E F0 5.827(.W).18 G(hen)-5.827 E F1
|
||||
(alues of each)-.25 F F1(name)3.326 E F0 5.827(.W).18 G(hen)-5.827 E F2
|
||||
<ad70>3.327 E F0 .827(is used,)3.327 F .22
|
||||
(additional options are ignored.)144 196.8 R(The)5.22 E F1<ad46>2.72 E
|
||||
(additional options are ignored.)144 213.6 R(The)5.22 E F2<ad46>2.72 E
|
||||
F0 .22(option inhibits the display of function de\214nitions; only the)
|
||||
2.72 F .466(function name and attrib)144 208.8 R .466(utes are printed.)
|
||||
-.2 F .466(If the)5.466 F F1(extdeb)2.966 E(ug)-.2 E F0 .466
|
||||
(shell option is enabled using)2.966 F F1(shopt)2.966 E F0 2.966(,t)C
|
||||
2.72 F .466(function name and attrib)144 225.6 R .466(utes are printed.)
|
||||
-.2 F .466(If the)5.466 F F2(extdeb)2.966 E(ug)-.2 E F0 .466
|
||||
(shell option is enabled using)2.966 F F2(shopt)2.966 E F0 2.966(,t)C
|
||||
(he)-2.966 E 1.308(source \214le name and line number where the functio\
|
||||
n is de\214ned are displayed as well.)144 220.8 R(The)6.308 E F1<ad46>
|
||||
3.808 E F0 .19(option implies)144 232.8 R F1<ad66>2.69 E F0 5.19(.T)C
|
||||
n is de\214ned are displayed as well.)144 237.6 R(The)6.308 E F2<ad46>
|
||||
3.808 E F0 .19(option implies)144 249.6 R F2<ad66>2.69 E F0 5.19(.T)C
|
||||
.19(he follo)-5.19 F .191
|
||||
(wing options can be used to restrict output to v)-.25 F .191
|
||||
(ariables with the speci-)-.25 F(\214ed attrib)144 244.8 Q(ute or to gi)
|
||||
-.2 E .3 -.15(ve v)-.25 H(ariables attrib)-.1 E(utes:)-.2 E F1<ad61>144
|
||||
256.8 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 268.8 Q F0(Use function names only)26.97 E(.)-.65 E F1
|
||||
<ad69>144 280.8 Q F0 .558(The v)27.52 F .558
|
||||
(ariables with the speci-)-.25 F(\214ed attrib)144 261.6 Q(ute or to gi)
|
||||
-.2 E .3 -.15(ve v)-.25 H(ariables attrib)-.1 E(utes:)-.2 E F2<ad61>144
|
||||
273.6 Q F0(Each)25.3 E F1(name)2.5 E F0(is an array v)2.5 E
|
||||
(ariable \(see)-.25 E F2(Arrays)2.5 E F0(abo)2.5 E -.15(ve)-.15 G(\).)
|
||||
.15 E F2<ad66>144 285.6 Q F0(Use function names only)26.97 E(.)-.65 E F2
|
||||
<ad69>144 297.6 Q F0 .558(The v)27.52 F .558
|
||||
(ariable is treated as an inte)-.25 F .558(ger; arithmetic e)-.15 F -.25
|
||||
(va)-.25 G .558(luation \(see).25 F/F4 9/Times-Bold@0 SF .557
|
||||
(ARITHMETIC EV)3.058 F(ALU)-1.215 E(A-)-.54 E(TION \))180 292.8 Q F0
|
||||
(ARITHMETIC EV)3.058 F(ALU)-1.215 E(A-)-.54 E(TION \))180 309.6 Q F0
|
||||
(is performed when the v)2.25 E(ariable is assigned a v)-.25 E(alue.)
|
||||
-.25 E F1<ad72>144 304.8 Q F0(Mak)25.86 E(e)-.1 E F2(name)5.046 E F0
|
||||
-.25 E F2<ad72>144 321.6 Q F0(Mak)25.86 E(e)-.1 E F1(name)5.046 E F0
|
||||
5.046(sr)C(eadonly)-5.046 E 7.546(.T)-.65 G 2.546
|
||||
(hese names cannot then be assigned v)-7.546 F 2.547
|
||||
(alues by subsequent)-.25 F(assignment statements or unset.)180 316.8 Q
|
||||
F1<ad74>144 328.8 Q F0(Gi)26.97 E 1.231 -.15(ve e)-.25 H(ach).15 E F2
|
||||
(name)3.431 E F0(the)3.431 E F2(tr)3.431 E(ace)-.15 E F0(attrib)3.431 E
|
||||
3.431(ute. T)-.2 F .931(raced functions inherit the)-.35 F F1(DEB)3.431
|
||||
E(UG)-.1 E F0 .93(trap from the)3.43 F(calling shell.)180 340.8 Q
|
||||
(alues by subsequent)-.25 F(assignment statements or unset.)180 333.6 Q
|
||||
F2<ad74>144 345.6 Q F0(Gi)26.97 E 1.231 -.15(ve e)-.25 H(ach).15 E F1
|
||||
(name)3.431 E F0(the)3.431 E F1(tr)3.431 E(ace)-.15 E F0(attrib)3.431 E
|
||||
3.431(ute. T)-.2 F .931(raced functions inherit the)-.35 F F2(DEB)3.431
|
||||
E(UG)-.1 E F0 .93(trap from the)3.43 F(calling shell.)180 357.6 Q
|
||||
(The trace attrib)5 E(ute has no special meaning for v)-.2 E(ariables.)
|
||||
-.25 E F1<ad78>144 352.8 Q F0(Mark)25.3 E F2(name)2.5 E F0 2.5(sf)C
|
||||
-.25 E F2<ad78>144 369.6 Q F0(Mark)25.3 E F1(name)2.5 E F0 2.5(sf)C
|
||||
(or e)-2.5 E(xport to subsequent commands via the en)-.15 E(vironment.)
|
||||
-.4 E .336(Using `+' instead of `\255' turns of)144 369.6 R 2.837(ft)
|
||||
-.4 E .336(Using `+' instead of `\255' turns of)144 386.4 R 2.837(ft)
|
||||
-.25 G .337(he attrib)-2.837 F .337(ute instead, with the e)-.2 F .337
|
||||
(xception that)-.15 F F1(+a)2.837 E F0 .337(may not be used)2.837 F .793
|
||||
(to destro)144 381.6 R 3.293(ya)-.1 G 3.293(na)-3.293 G .793(rray v)
|
||||
(xception that)-.15 F F2(+a)2.837 E F0 .337(may not be used)2.837 F .793
|
||||
(to destro)144 398.4 R 3.293(ya)-.1 G 3.293(na)-3.293 G .793(rray v)
|
||||
-3.293 F 3.293(ariable. When)-.25 F .793(used in a function, mak)3.293 F
|
||||
.793(es each)-.1 F F2(name)3.293 E F0 .793(local, as with the)3.293 F F1
|
||||
(local)3.292 E F0 2.842(command. If)144 393.6 R 2.842(av)2.842 G .342
|
||||
(ariable name is follo)-3.092 F .342(wed by =)-.25 F F2(value)A F0 2.842
|
||||
.793(es each)-.1 F F1(name)3.293 E F0 .793(local, as with the)3.293 F F2
|
||||
(local)3.292 E F0 2.842(command. If)144 410.4 R 2.842(av)2.842 G .342
|
||||
(ariable name is follo)-3.092 F .342(wed by =)-.25 F F1(value)A F0 2.842
|
||||
(,t)C .342(he v)-2.842 F .342(alue of the v)-.25 F .343
|
||||
(ariable is set to)-.25 F F2(value)2.843 E F0 5.343(.T)C(he)-5.343 E
|
||||
.801(return v)144 405.6 R .801(alue is 0 unless an in)-.25 F -.25(va)-.4
|
||||
(ariable is set to)-.25 F F1(value)2.843 E F0 5.343(.T)C(he)-5.343 E
|
||||
.801(return v)144 422.4 R .801(alue is 0 unless an in)-.25 F -.25(va)-.4
|
||||
G .8
|
||||
(lid option is encountered, an attempt is made to de\214ne a function)
|
||||
.25 F(using)144 417.6 Q/F5 10/Courier@0 SF 1.038(\255f foo=bar)3.538 F
|
||||
.25 F(using)144 434.4 Q/F5 10/Courier@0 SF 1.038(\255f foo=bar)3.538 F
|
||||
F0 3.538(,a)C 3.538(na)-3.538 G 1.038(ttempt is made to assign a v)
|
||||
-3.538 F 1.038(alue to a readonly v)-.25 F 1.039(ariable, an attempt is)
|
||||
-.25 F .974(made to assign a v)144 429.6 R .974(alue to an array v)-.25
|
||||
-.25 F .974(made to assign a v)144 446.4 R .974(alue to an array v)-.25
|
||||
F .974(ariable without using the compound assignment syntax \(see)-.25 F
|
||||
F1(Arrays)144 441.6 Q F0(abo)2.86 E -.15(ve)-.15 G .36(\), one of the)
|
||||
.15 F F2(names)2.86 E F0 .36(is not a v)2.86 F .36(alid shell v)-.25 F
|
||||
F2(Arrays)144 458.4 Q F0(abo)2.86 E -.15(ve)-.15 G .36(\), one of the)
|
||||
.15 F F1(names)2.86 E F0 .36(is not a v)2.86 F .36(alid shell v)-.25 F
|
||||
.36(ariable name, an attempt is made to turn of)-.25 F(f)-.25 E .057
|
||||
(readonly status for a readonly v)144 453.6 R .057
|
||||
(readonly status for a readonly v)144 470.4 R .057
|
||||
(ariable, an attempt is made to turn of)-.25 F 2.556(fa)-.25 G .056
|
||||
(rray status for an array v)-2.556 F(ari-)-.25 E
|
||||
(able, or an attempt is made to display a non-e)144 465.6 Q
|
||||
(xistent function with)-.15 E F1<ad66>2.5 E F0(.)A F1
|
||||
(dirs [\255clpv] [+)108 482.4 Q F2(n)A F1 2.5(][)C<ad>-2.5 E F2(n)A F1
|
||||
(])A F0 -.4(Wi)144 494.4 S .328
|
||||
(able, or an attempt is made to display a non-e)144 482.4 Q
|
||||
(xistent function with)-.15 E F2<ad66>2.5 E F0(.)A F2
|
||||
(dirs [\255clpv] [+)108 499.2 Q F1(n)A F2 2.5(][)C<ad>-2.5 E F1(n)A F2
|
||||
(])A F0 -.4(Wi)144 511.2 S .328
|
||||
(thout options, displays the list of currently remembered directories.)
|
||||
.4 F .329(The def)5.329 F .329(ault display is on a)-.1 F 1.238
|
||||
(single line with directory names separated by spaces.)144 506.4 R 1.238
|
||||
(Directories are added to the list with the)6.238 F F1(pushd)144 518.4 Q
|
||||
F0(command; the)2.5 E F1(popd)2.5 E F0(command remo)2.5 E -.15(ve)-.15 G
|
||||
2.5(se).15 G(ntries from the list.)-2.5 E F1(+)144 530.4 Q F2(n)A F0
|
||||
1.564(Displays the)25.3 F F2(n)4.064 E F0 1.565
|
||||
(th entry counting from the left of the list sho)B 1.565(wn by)-.25 F F1
|
||||
(single line with directory names separated by spaces.)144 523.2 R 1.238
|
||||
(Directories are added to the list with the)6.238 F F2(pushd)144 535.2 Q
|
||||
F0(command; the)2.5 E F2(popd)2.5 E F0(command remo)2.5 E -.15(ve)-.15 G
|
||||
2.5(se).15 G(ntries from the list.)-2.5 E F2(+)144 547.2 Q F1(n)A F0
|
||||
1.564(Displays the)25.3 F F1(n)4.064 E F0 1.565
|
||||
(th entry counting from the left of the list sho)B 1.565(wn by)-.25 F F2
|
||||
(dirs)4.065 E F0 1.565(when in)4.065 F -.2(vo)-.4 G -.1(ke).2 G(d).1 E
|
||||
(without options, starting with zero.)180 542.4 Q F1<ad>144 554.4 Q F2
|
||||
(n)A F0 1.194(Displays the)25.3 F F2(n)3.694 E F0 1.194
|
||||
(without options, starting with zero.)180 559.2 Q F2<ad>144 571.2 Q F1
|
||||
(n)A F0 1.194(Displays the)25.3 F F1(n)3.694 E F0 1.194
|
||||
(th entry counting from the right of the list sho)B 1.194(wn by)-.25 F
|
||||
F1(dirs)3.694 E F0 1.194(when in)3.694 F -.2(vo)-.4 G -.1(ke).2 G(d).1 E
|
||||
(without options, starting with zero.)180 566.4 Q F1<ad63>144 578.4 Q F0
|
||||
(Clears the directory stack by deleting all of the entries.)25.86 E F1
|
||||
<ad6c>144 590.4 Q F0 .324(Produces a longer listing; the def)27.52 F
|
||||
F2(dirs)3.694 E F0 1.194(when in)3.694 F -.2(vo)-.4 G -.1(ke).2 G(d).1 E
|
||||
(without options, starting with zero.)180 583.2 Q F2<ad63>144 595.2 Q F0
|
||||
(Clears the directory stack by deleting all of the entries.)25.86 E F2
|
||||
<ad6c>144 607.2 Q F0 .324(Produces a longer listing; the def)27.52 F
|
||||
.324(ault listing format uses a tilde to denote the home direc-)-.1 F
|
||||
(tory)180 602.4 Q(.)-.65 E F1<ad70>144 614.4 Q F0
|
||||
(Print the directory stack with one entry per line.)24.74 E F1<ad76>144
|
||||
626.4 Q F0 .273(Print the directory stack with one entry per line, pre\
|
||||
(tory)180 619.2 Q(.)-.65 E F2<ad70>144 631.2 Q F0
|
||||
(Print the directory stack with one entry per line.)24.74 E F2<ad76>144
|
||||
643.2 Q F0 .273(Print the directory stack with one entry per line, pre\
|
||||
\214xing each entry with its inde)25.3 F 2.772(xi)-.15 G 2.772(nt)-2.772
|
||||
G(he)-2.772 E(stack.)180 638.4 Q .257(The return v)144 655.2 R .258
|
||||
G(he)-2.772 E(stack.)180 655.2 Q .257(The return v)144 672 R .258
|
||||
(alue is 0 unless an in)-.25 F -.25(va)-.4 G .258
|
||||
(lid option is supplied or).25 F F2(n)2.758 E F0(inde)2.758 E -.15(xe)
|
||||
(lid option is supplied or).25 F F1(n)2.758 E F0(inde)2.758 E -.15(xe)
|
||||
-.15 G 2.758(sb).15 G -.15(ey)-2.758 G .258(ond the end of the direc-)
|
||||
.15 F(tory stack.)144 667.2 Q F1(diso)108 684 Q(wn)-.1 E F0([)2.5 E F1
|
||||
(\255ar)A F0 2.5(][)C F1<ad68>-2.5 E F0 2.5(][)C F2(jobspec)-2.5 E F0
|
||||
(...])2.5 E -.4(Wi)144 696 S .331(thout options, each).4 F F2(jobspec)
|
||||
.15 F(tory stack.)144 684 Q F2(diso)108 700.8 Q(wn)-.1 E F0([)2.5 E F2
|
||||
(\255ar)A F0 2.5(][)C F2<ad68>-2.5 E F0 2.5(][)C F1(jobspec)-2.5 E F0
|
||||
(...])2.5 E -.4(Wi)144 712.8 S .331(thout options, each).4 F F1(jobspec)
|
||||
4.571 E F0 .331(is remo)3.141 F -.15(ve)-.15 G 2.831(df).15 G .331
|
||||
(rom the table of acti)-2.831 F .63 -.15(ve j)-.25 H 2.83(obs. If).15 F
|
||||
(the)2.83 E F1<ad68>2.83 E F0 .33(option is gi)2.83 F -.15(ve)-.25 G(n,)
|
||||
.15 E(each)144 708 Q F2(jobspec)4.52 E F0 .28(is not remo)3.09 F -.15
|
||||
(the)2.83 E F2<ad68>2.83 E F0 .33(option is gi)2.83 F -.15(ve)-.25 G(n,)
|
||||
.15 E(each)144 724.8 Q F1(jobspec)4.52 E F0 .28(is not remo)3.09 F -.15
|
||||
(ve)-.15 G 2.78(df).15 G .28(rom the table, b)-2.78 F .28(ut is mark)-.2
|
||||
F .28(ed so that)-.1 F F4(SIGHUP)2.78 E F0 .281
|
||||
(is not sent to the job if)2.53 F 1.332(the shell recei)144 720 R -.15
|
||||
(ve)-.25 G 3.832(sa).15 G F4(SIGHUP)A/F6 9/Times-Roman@0 SF(.)A F0 1.332
|
||||
(If no)5.832 F F2(jobspec)5.572 E F0 1.332(is present, and neither the)
|
||||
4.142 F F1<ad61>3.832 E F0 1.332(nor the)3.832 F F1<ad72>3.832 E F0
|
||||
1.331(option is)3.831 F(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(5)
|
||||
203.725 E 0 Cg EP
|
||||
(is not sent to the job if)2.53 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
|
||||
BP
|
||||
%%EndPageSetup
|
||||
/F0 10/Times-Roman@0 SF -.35(BA)72 48 S(SH_B).35 E(UIL)-.1 E 290.48
|
||||
(TINS\(1\) B)-.92 F(ASH_B)-.35 E(UIL)-.1 E(TINS\(1\))-.92 E 1.228
|
||||
(supplied, the)144 84 R/F1 10/Times-Italic@0 SF(curr)3.728 E 1.228
|
||||
(ent job)-.37 F F0 1.229(is used.)3.729 F 1.229(If no)6.229 F F1
|
||||
(jobspec)5.469 E F0 1.229(is supplied, the)4.039 F/F2 10/Times-Bold@0 SF
|
||||
<ad61>3.729 E F0 1.229(option means to remo)3.729 F 1.529 -.15(ve o)-.15
|
||||
H(r).15 E .657(mark all jobs; the)144 96 R F2<ad72>3.157 E F0 .657
|
||||
(option without a)3.157 F F1(jobspec)4.897 E F0(ar)3.467 E .656
|
||||
(gument restricts operation to running jobs.)-.18 F(The)5.656 E
|
||||
(return v)144 108 Q(alue is 0 unless a)-.25 E F1(jobspec)4.24 E F0
|
||||
(does not specify a v)2.81 E(alid job)-.25 E(.)-.4 E F2(echo)108 124.8 Q
|
||||
F0([)2.5 E F2(\255neE)A F0 2.5(][)C F1(ar)-2.5 E(g)-.37 E F0(...])2.5 E
|
||||
.394(Output the)144 136.8 R F1(ar)2.894 E(g)-.37 E F0 .394
|
||||
(TINS\(1\) B)-.92 F(ASH_B)-.35 E(UIL)-.1 E(TINS\(1\))-.92 E .224
|
||||
(the shell recei)144 84 R -.15(ve)-.25 G 2.724(sa).15 G/F1 9
|
||||
/Times-Bold@0 SF(SIGHUP)A/F2 9/Times-Roman@0 SF(.)A F0 .224(If no)4.724
|
||||
F/F3 10/Times-Italic@0 SF(jobspec)4.464 E F0 .224
|
||||
(is present, and neither the)3.034 F/F4 10/Times-Bold@0 SF<ad61>2.724 E
|
||||
F0 .224(nor the)2.724 F F4<ad72>2.724 E F0 .223(option is sup-)2.724 F
|
||||
.651(plied, the)144 96 R F3(curr)3.151 E .651(ent job)-.37 F F0 .651
|
||||
(is used.)3.151 F .652(If no)5.651 F F3(jobspec)4.892 E F0 .652
|
||||
(is supplied, the)3.462 F F4<ad61>3.152 E F0 .652(option means to remo)
|
||||
3.152 F .952 -.15(ve o)-.15 H 3.152(rm).15 G(ark)-3.152 E .435
|
||||
(all jobs; the)144 108 R F4<ad72>2.935 E F0 .435(option without a)2.935
|
||||
F F3(jobspec)4.675 E F0(ar)3.245 E .434
|
||||
(gument restricts operation to running jobs.)-.18 F .434(The return)
|
||||
5.434 F -.25(va)144 120 S(lue is 0 unless a).25 E F3(jobspec)4.24 E F0
|
||||
(does not specify a v)2.81 E(alid job)-.25 E(.)-.4 E F4(echo)108 136.8 Q
|
||||
F0([)2.5 E F4(\255neE)A F0 2.5(][)C F3(ar)-2.5 E(g)-.37 E F0(...])2.5 E
|
||||
.394(Output the)144 148.8 R F3(ar)2.894 E(g)-.37 E F0 .394
|
||||
(s, separated by spaces, follo)B .395(wed by a ne)-.25 F 2.895
|
||||
(wline. The)-.25 F .395(return status is al)2.895 F -.1(wa)-.1 G .395
|
||||
(ys 0.).1 F(If)5.395 E F2<ad6e>2.895 E F0 .549
|
||||
(is speci\214ed, the trailing ne)144 148.8 R .548(wline is suppressed.)
|
||||
-.25 F .548(If the)5.548 F F2<ad65>3.048 E F0 .548(option is gi)3.048 F
|
||||
-.15(ve)-.25 G .548(n, interpretation of the fol-).15 F(lo)144 160.8 Q
|
||||
.052(wing backslash-escaped characters is enabled.)-.25 F(The)5.052 E F2
|
||||
(ys 0.).1 F(If)5.395 E F4<ad6e>2.895 E F0 .549
|
||||
(is speci\214ed, the trailing ne)144 160.8 R .548(wline is suppressed.)
|
||||
-.25 F .548(If the)5.548 F F4<ad65>3.048 E F0 .548(option is gi)3.048 F
|
||||
-.15(ve)-.25 G .548(n, interpretation of the fol-).15 F(lo)144 172.8 Q
|
||||
.052(wing backslash-escaped characters is enabled.)-.25 F(The)5.052 E F4
|
||||
<ad45>2.552 E F0 .053(option disables the interpretation of these)2.553
|
||||
F 1.503(escape characters, e)144 172.8 R -.15(ve)-.25 G 4.003(no).15 G
|
||||
F 1.503(escape characters, e)144 184.8 R -.15(ve)-.25 G 4.003(no).15 G
|
||||
4.003(ns)-4.003 G 1.502(ystems where the)-4.003 F 4.002(ya)-.15 G 1.502
|
||||
(re interpreted by def)-4.002 F 4.002(ault. The)-.1 F F2(xpg_echo)4.002
|
||||
(re interpreted by def)-4.002 F 4.002(ault. The)-.1 F F4(xpg_echo)4.002
|
||||
E F0(shell)4.002 E .009
|
||||
(option may be used to dynamically determine whether or not)144 184.8 R
|
||||
F2(echo)2.509 E F0 -.15(ex)2.51 G .01(pands these escape characters).15
|
||||
F .66(by def)144 196.8 R(ault.)-.1 E F2(echo)5.66 E F0 .66
|
||||
(does not interpret)3.16 F F2<adad>3.16 E F0 .659
|
||||
(to mean the end of options.)3.159 F F2(echo)5.659 E F0 .659
|
||||
(interprets the follo)3.159 F(wing)-.25 E(escape sequences:)144 208.8 Q
|
||||
F2(\\a)144 220.8 Q F0(alert \(bell\))28.22 E F2(\\b)144 232.8 Q F0
|
||||
(backspace)27.66 E F2(\\c)144 244.8 Q F0(suppress trailing ne)28.78 E
|
||||
(wline)-.25 E F2(\\e)144 256.8 Q F0(an escape character)28.78 E F2(\\f)
|
||||
144 268.8 Q F0(form feed)29.89 E F2(\\n)144 280.8 Q F0(ne)27.66 E 2.5
|
||||
(wl)-.25 G(ine)-2.5 E F2(\\r)144 292.8 Q F0(carriage return)28.78 E F2
|
||||
(\\t)144 304.8 Q F0(horizontal tab)29.89 E F2(\\v)144 316.8 Q F0 -.15
|
||||
(ve)28.22 G(rtical tab).15 E F2(\\\\)144 328.8 Q F0(backslash)30.44 E F2
|
||||
(\\0)144 340.8 Q F1(nnn)A F0(the eight-bit character whose v)13.22 E
|
||||
(alue is the octal v)-.25 E(alue)-.25 E F1(nnn)2.5 E F0
|
||||
(\(zero to three octal digits\))2.5 E F2(\\)144 352.8 Q F1(nnn)A F0
|
||||
(option may be used to dynamically determine whether or not)144 196.8 R
|
||||
F4(echo)2.509 E F0 -.15(ex)2.51 G .01(pands these escape characters).15
|
||||
F .66(by def)144 208.8 R(ault.)-.1 E F4(echo)5.66 E F0 .66
|
||||
(does not interpret)3.16 F F4<adad>3.16 E F0 .659
|
||||
(to mean the end of options.)3.159 F F4(echo)5.659 E F0 .659
|
||||
(interprets the follo)3.159 F(wing)-.25 E(escape sequences:)144 220.8 Q
|
||||
F4(\\a)144 232.8 Q F0(alert \(bell\))28.22 E F4(\\b)144 244.8 Q F0
|
||||
(backspace)27.66 E F4(\\c)144 256.8 Q F0(suppress trailing ne)28.78 E
|
||||
(wline)-.25 E F4(\\e)144 268.8 Q F0(an escape character)28.78 E F4(\\f)
|
||||
144 280.8 Q F0(form feed)29.89 E F4(\\n)144 292.8 Q F0(ne)27.66 E 2.5
|
||||
(wl)-.25 G(ine)-2.5 E F4(\\r)144 304.8 Q F0(carriage return)28.78 E F4
|
||||
(\\t)144 316.8 Q F0(horizontal tab)29.89 E F4(\\v)144 328.8 Q F0 -.15
|
||||
(ve)28.22 G(rtical tab).15 E F4(\\\\)144 340.8 Q F0(backslash)30.44 E F4
|
||||
(\\0)144 352.8 Q F3(nnn)A F0(the eight-bit character whose v)13.22 E
|
||||
(alue is the octal v)-.25 E(alue)-.25 E F3(nnn)2.5 E F0
|
||||
(\(zero to three octal digits\))2.5 E F4(\\)144 364.8 Q F3(nnn)A F0
|
||||
(the eight-bit character whose v)18.22 E(alue is the octal v)-.25 E
|
||||
(alue)-.25 E F1(nnn)2.5 E F0(\(one to three octal digits\))2.5 E F2(\\x)
|
||||
144 364.8 Q F1(HH)A F0(the eight-bit character whose v)13.78 E
|
||||
(alue is the he)-.25 E(xadecimal v)-.15 E(alue)-.25 E F1(HH)2.5 E F0
|
||||
(\(one or tw)2.5 E 2.5(oh)-.1 G .3 -.15(ex d)-2.5 H(igits\)).15 E F2
|
||||
(enable)108 381.6 Q F0([)2.5 E F2(\255adnps)A F0 2.5(][)C F2<ad66>-2.5 E
|
||||
F1(\214lename)2.5 E F0 2.5(][)C F1(name)-2.5 E F0(...])2.5 E .277
|
||||
(Enable and disable b)144 393.6 R .278(uiltin shell commands.)-.2 F .278
|
||||
(alue)-.25 E F3(nnn)2.5 E F0(\(one to three octal digits\))2.5 E F4(\\x)
|
||||
144 376.8 Q F3(HH)A F0(the eight-bit character whose v)13.78 E
|
||||
(alue is the he)-.25 E(xadecimal v)-.15 E(alue)-.25 E F3(HH)2.5 E F0
|
||||
(\(one or tw)2.5 E 2.5(oh)-.1 G .3 -.15(ex d)-2.5 H(igits\)).15 E F4
|
||||
(enable)108 393.6 Q F0([)2.5 E F4(\255adnps)A F0 2.5(][)C F4<ad66>-2.5 E
|
||||
F3(\214lename)2.5 E F0 2.5(][)C F3(name)-2.5 E F0(...])2.5 E .277
|
||||
(Enable and disable b)144 405.6 R .278(uiltin shell commands.)-.2 F .278
|
||||
(Disabling a b)5.278 F .278(uiltin allo)-.2 F .278
|
||||
(ws a disk command which has)-.25 F .834(the same name as a shell b)144
|
||||
405.6 R .834(uiltin to be e)-.2 F -.15(xe)-.15 G .834
|
||||
417.6 R .834(uiltin to be e)-.2 F -.15(xe)-.15 G .834
|
||||
(cuted without specifying a full pathname, e).15 F -.15(ve)-.25 G 3.333
|
||||
(nt).15 G(hough)-3.333 E .989(the shell normally searches for b)144
|
||||
417.6 R .989(uiltins before disk commands.)-.2 F(If)5.989 E F2<ad6e>
|
||||
3.489 E F0 .99(is used, each)3.49 F F1(name)3.49 E F0 .99(is dis-)3.49 F
|
||||
1.582(abled; otherwise,)144 429.6 R F1(names)4.082 E F0 1.582
|
||||
429.6 R .989(uiltins before disk commands.)-.2 F(If)5.989 E F4<ad6e>
|
||||
3.489 E F0 .99(is used, each)3.49 F F3(name)3.49 E F0 .99(is dis-)3.49 F
|
||||
1.582(abled; otherwise,)144 441.6 R F3(names)4.082 E F0 1.582
|
||||
(are enabled.)4.082 F -.15(Fo)6.582 G 4.082(re).15 G 1.582
|
||||
(xample, to use the)-4.232 F F2(test)4.082 E F0 1.582
|
||||
(binary found via the)4.082 F/F3 9/Times-Bold@0 SF -.666(PA)4.081 G(TH)
|
||||
-.189 E F0 .08(instead of the shell b)144 441.6 R .08(uiltin v)-.2 F .08
|
||||
(ersion, run)-.15 F/F4 10/Courier@0 SF .081(enable -n test)2.58 F F0
|
||||
5.081(.T)C(he)-5.081 E F2<ad66>2.581 E F0 .081
|
||||
(option means to load the ne)2.581 F(w)-.25 E -.2(bu)144 453.6 S 1.525
|
||||
(iltin command).2 F F1(name)4.385 E F0 1.524(from shared object)4.204 F
|
||||
F1(\214lename)4.024 E F0 4.024(,o).18 G 4.024(ns)-4.024 G 1.524
|
||||
(ystems that support dynamic loading.)-4.024 F(The)144 465.6 Q F2<ad64>
|
||||
2.866 E F0 .366(option will delete a b)2.866 F .366(uiltin pre)-.2 F
|
||||
.366(viously loaded with)-.25 F F2<ad66>2.867 E F0 5.367(.I)C 2.867(fn)
|
||||
-5.367 G(o)-2.867 E F1(name)2.867 E F0(ar)2.867 E .367(guments are gi)
|
||||
-.18 F -.15(ve)-.25 G .367(n, or).15 F .399(if the)144 477.6 R F2<ad70>
|
||||
2.899 E F0 .399(option is supplied, a list of shell b)2.899 F .399
|
||||
(uiltins is printed.)-.2 F -.4(Wi)5.399 G .399(th no other option ar).4
|
||||
F .398(guments, the)-.18 F .098(list consists of all enabled shell b)144
|
||||
489.6 R 2.598(uiltins. If)-.2 F F2<ad6e>2.598 E F0 .098
|
||||
(is supplied, only disabled b)2.598 F .099(uiltins are printed.)-.2 F
|
||||
(If)5.099 E F2<ad61>2.599 E F0 1.917
|
||||
(is supplied, the list printed includes all b)144 501.6 R 1.916
|
||||
(xample, to use the)-4.232 F F4(test)4.082 E F0 1.582
|
||||
(binary found via the)4.082 F F1 -.666(PA)4.081 G(TH)-.189 E F0 .08
|
||||
(instead of the shell b)144 453.6 R .08(uiltin v)-.2 F .08(ersion, run)
|
||||
-.15 F/F5 10/Courier@0 SF .081(enable -n test)2.58 F F0 5.081(.T)C(he)
|
||||
-5.081 E F4<ad66>2.581 E F0 .081(option means to load the ne)2.581 F(w)
|
||||
-.25 E -.2(bu)144 465.6 S 1.525(iltin command).2 F F3(name)4.385 E F0
|
||||
1.524(from shared object)4.204 F F3(\214lename)4.024 E F0 4.024(,o).18 G
|
||||
4.024(ns)-4.024 G 1.524(ystems that support dynamic loading.)-4.024 F
|
||||
(The)144 477.6 Q F4<ad64>2.866 E F0 .366(option will delete a b)2.866 F
|
||||
.366(uiltin pre)-.2 F .366(viously loaded with)-.25 F F4<ad66>2.867 E F0
|
||||
5.367(.I)C 2.867(fn)-5.367 G(o)-2.867 E F3(name)2.867 E F0(ar)2.867 E
|
||||
.367(guments are gi)-.18 F -.15(ve)-.25 G .367(n, or).15 F .399(if the)
|
||||
144 489.6 R F4<ad70>2.899 E F0 .399
|
||||
(option is supplied, a list of shell b)2.899 F .399(uiltins is printed.)
|
||||
-.2 F -.4(Wi)5.399 G .399(th no other option ar).4 F .398(guments, the)
|
||||
-.18 F .098(list consists of all enabled shell b)144 501.6 R 2.598
|
||||
(uiltins. If)-.2 F F4<ad6e>2.598 E F0 .098(is supplied, only disabled b)
|
||||
2.598 F .099(uiltins are printed.)-.2 F(If)5.099 E F4<ad61>2.599 E F0
|
||||
1.917(is supplied, the list printed includes all b)144 513.6 R 1.916
|
||||
(uiltins, with an indication of whether or not each is)-.2 F 2.878
|
||||
(enabled. If)144 513.6 R F2<ad73>2.878 E F0 .379
|
||||
(is supplied, the output is restricted to the POSIX)2.878 F F1(special)
|
||||
(enabled. If)144 525.6 R F4<ad73>2.878 E F0 .379
|
||||
(is supplied, the output is restricted to the POSIX)2.878 F F3(special)
|
||||
2.879 E F0 -.2(bu)2.879 G 2.879(iltins. The).2 F .379(return v)2.879 F
|
||||
(alue)-.25 E .995(is 0 unless a)144 525.6 R F1(name)3.855 E F0 .994
|
||||
(alue)-.25 E .995(is 0 unless a)144 537.6 R F3(name)3.855 E F0 .994
|
||||
(is not a shell b)3.675 F .994(uiltin or there is an error loading a ne)
|
||||
-.2 F 3.494(wb)-.25 G .994(uiltin from a shared)-3.694 F(object.)144
|
||||
537.6 Q F2 -2.3 -.15(ev a)108 554.4 T(l).15 E F0([)2.5 E F1(ar)A(g)-.37
|
||||
E F0(...])2.5 E(The)144 566.4 Q F1(ar)3.17 E(g)-.37 E F0 3.17(sa)C .671
|
||||
549.6 Q F4 -2.3 -.15(ev a)108 566.4 T(l).15 E F0([)2.5 E F3(ar)A(g)-.37
|
||||
E F0(...])2.5 E(The)144 578.4 Q F3(ar)3.17 E(g)-.37 E F0 3.17(sa)C .671
|
||||
(re read and concatenated together into a single command.)-3.17 F .671
|
||||
(This command is then read)5.671 F .495(and e)144 578.4 R -.15(xe)-.15 G
|
||||
(This command is then read)5.671 F .495(and e)144 590.4 R -.15(xe)-.15 G
|
||||
.495(cuted by the shell, and its e).15 F .495
|
||||
(xit status is returned as the v)-.15 F .495(alue of)-.25 F F2 -2.3 -.15
|
||||
(xit status is returned as the v)-.15 F .495(alue of)-.25 F F4 -2.3 -.15
|
||||
(ev a)2.995 H(l).15 E F0 5.495(.I)C 2.995(ft)-5.495 G .495(here are no)
|
||||
-2.995 F F1(ar)2.995 E(gs)-.37 E F0(,).27 E(or only null ar)144 590.4 Q
|
||||
(guments,)-.18 E F2 -2.3 -.15(ev a)2.5 H(l).15 E F0(returns 0.)2.5 E F2
|
||||
(exec)108 607.2 Q F0([)2.5 E F2(\255cl)A F0 2.5(][)C F2<ad61>-2.5 E F1
|
||||
(name)2.5 E F0 2.5(][)C F1(command)-2.5 E F0([)2.5 E F1(ar)A(guments)
|
||||
-.37 E F0(]])A(If)144 619.2 Q F1(command)3.005 E F0 .305
|
||||
-2.995 F F3(ar)2.995 E(gs)-.37 E F0(,).27 E(or only null ar)144 602.4 Q
|
||||
(guments,)-.18 E F4 -2.3 -.15(ev a)2.5 H(l).15 E F0(returns 0.)2.5 E F4
|
||||
(exec)108 619.2 Q F0([)2.5 E F4(\255cl)A F0 2.5(][)C F4<ad61>-2.5 E F3
|
||||
(name)2.5 E F0 2.5(][)C F3(command)-2.5 E F0([)2.5 E F3(ar)A(guments)
|
||||
-.37 E F0(]])A(If)144 631.2 Q F3(command)3.005 E F0 .305
|
||||
(is speci\214ed, it replaces the shell.)3.575 F .305(No ne)5.305 F 2.805
|
||||
(wp)-.25 G .306(rocess is created.)-2.805 F(The)5.306 E F1(ar)3.136 E
|
||||
(guments)-.37 E F0(become)3.076 E .177(the ar)144 631.2 R .177
|
||||
(guments to)-.18 F F1(command)2.676 E F0 5.176(.I)C 2.676(ft)-5.176 G
|
||||
(he)-2.676 E F2<ad6c>2.676 E F0 .176
|
||||
(wp)-.25 G .306(rocess is created.)-2.805 F(The)5.306 E F3(ar)3.136 E
|
||||
(guments)-.37 E F0(become)3.076 E .177(the ar)144 643.2 R .177
|
||||
(guments to)-.18 F F3(command)2.676 E F0 5.176(.I)C 2.676(ft)-5.176 G
|
||||
(he)-2.676 E F4<ad6c>2.676 E F0 .176
|
||||
(option is supplied, the shell places a dash at the be)2.676 F .176
|
||||
(ginning of)-.15 F .159(the zeroth ar)144 643.2 R 2.659(gp)-.18 G .159
|
||||
(assed to)-2.659 F F1(command)2.659 E F0 5.159(.T).77 G .159
|
||||
(his is what)-5.159 F F1(lo)2.659 E(gin)-.1 E F0 .159(\(1\) does.).24 F
|
||||
(The)5.16 E F2<ad63>2.66 E F0 .16(option causes)2.66 F F1(command)2.86 E
|
||||
F0(to)3.43 E 1.196(be e)144 655.2 R -.15(xe)-.15 G 1.196
|
||||
(cuted with an empty en).15 F 3.696(vironment. If)-.4 F F2<ad61>3.696 E
|
||||
F0 1.196(is supplied, the shell passes)3.696 F F1(name)4.055 E F0 1.195
|
||||
(as the zeroth)3.875 F(ar)144 667.2 Q .02(gument to the e)-.18 F -.15
|
||||
(xe)-.15 G .02(cuted command.).15 F(If)5.02 E F1(command)2.72 E F0 .02
|
||||
(ginning of)-.15 F .159(the zeroth ar)144 655.2 R 2.659(gp)-.18 G .159
|
||||
(assed to)-2.659 F F3(command)2.659 E F0 5.159(.T).77 G .159
|
||||
(his is what)-5.159 F F3(lo)2.659 E(gin)-.1 E F0 .159(\(1\) does.).24 F
|
||||
(The)5.16 E F4<ad63>2.66 E F0 .16(option causes)2.66 F F3(command)2.86 E
|
||||
F0(to)3.43 E 1.196(be e)144 667.2 R -.15(xe)-.15 G 1.196
|
||||
(cuted with an empty en).15 F 3.696(vironment. If)-.4 F F4<ad61>3.696 E
|
||||
F0 1.196(is supplied, the shell passes)3.696 F F3(name)4.055 E F0 1.195
|
||||
(as the zeroth)3.875 F(ar)144 679.2 Q .02(gument to the e)-.18 F -.15
|
||||
(xe)-.15 G .02(cuted command.).15 F(If)5.02 E F3(command)2.72 E F0 .02
|
||||
(cannot be e)3.29 F -.15(xe)-.15 G .02
|
||||
(cuted for some reason, a non-inter).15 F(-)-.2 E(acti)144 679.2 Q 1.067
|
||||
(cuted for some reason, a non-inter).15 F(-)-.2 E(acti)144 691.2 Q 1.067
|
||||
-.15(ve s)-.25 H .767(hell e).15 F .767(xits, unless the shell option)
|
||||
-.15 F F2(execfail)3.266 E F0 .766
|
||||
-.15 F F4(execfail)3.266 E F0 .766
|
||||
(is enabled, in which case it returns f)3.266 F 3.266(ailure. An)-.1 F
|
||||
(interacti)144 691.2 Q 1.518 -.15(ve s)-.25 H 1.218(hell returns f).15 F
|
||||
(interacti)144 703.2 Q 1.518 -.15(ve s)-.25 H 1.218(hell returns f).15 F
|
||||
1.219(ailure if the \214le cannot be e)-.1 F -.15(xe)-.15 G 3.719
|
||||
(cuted. If).15 F F1(command)3.919 E F0 1.219(is not speci\214ed, an)
|
||||
4.489 F(y)-.15 E .134(redirections tak)144 703.2 R 2.634(ee)-.1 G -.25
|
||||
(cuted. If).15 F F3(command)3.919 E F0 1.219(is not speci\214ed, an)
|
||||
4.489 F(y)-.15 E .134(redirections tak)144 715.2 R 2.634(ee)-.1 G -.25
|
||||
(ff)-2.634 G .134(ect in the current shell, and the return status is 0.)
|
||||
.25 F .134(If there is a redirection error)5.134 F(,)-.4 E
|
||||
(the return status is 1.)144 715.2 Q(GNU Bash-3.0)72 768 Q(2004 Apr 20)
|
||||
(the return status is 1.)144 727.2 Q(GNU Bash-3.0)72 768 Q(2004 Apr 20)
|
||||
148.735 E(6)203.725 E 0 Cg EP
|
||||
%%Page: 7 7
|
||||
%%BeginPageSetup
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
%!PS-Adobe-3.0
|
||||
%%Creator: groff version 1.18.1
|
||||
%%CreationDate: Mon Aug 30 08:27:13 2004
|
||||
%%CreationDate: Tue Sep 21 11:57:03 2004
|
||||
%%DocumentNeededResources: font Times-Roman
|
||||
%%+ font Times-Bold
|
||||
%%DocumentSuppliedResources: procset grops 1.18 1
|
||||
|
||||
+1
-17
@@ -1360,6 +1360,7 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
|
||||
#if defined (JOB_CONTROL)
|
||||
terminate_current_pipeline ();
|
||||
kill_current_pipeline ();
|
||||
UNBLOCK_CHILD (oset);
|
||||
#endif /* JOB_CONTROL */
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
/* The unwind-protects installed below will take care
|
||||
@@ -2190,14 +2191,6 @@ execute_case_command (case_command)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Posix.2 specifies that the WORD is tilde expanded. */
|
||||
if (member ('~', case_command->word->word))
|
||||
{
|
||||
word = bash_tilde_expand (case_command->word->word, 0);
|
||||
free (case_command->word->word);
|
||||
case_command->word->word = word;
|
||||
}
|
||||
|
||||
wlist = expand_word_unsplit (case_command->word, 0);
|
||||
word = wlist ? string_list (wlist) : savestring ("");
|
||||
dispose_words (wlist);
|
||||
@@ -2215,15 +2208,6 @@ execute_case_command (case_command)
|
||||
QUIT;
|
||||
for (list = clauses->patterns; list; list = list->next)
|
||||
{
|
||||
/* Posix.2 specifies to tilde expand each member of the pattern
|
||||
list. */
|
||||
if (member ('~', list->word->word))
|
||||
{
|
||||
pattern = bash_tilde_expand (list->word->word, 0);
|
||||
free (list->word->word);
|
||||
list->word->word = pattern;
|
||||
}
|
||||
|
||||
es = expand_word_leave_quoted (list->word, 0);
|
||||
|
||||
if (es && es->word && es->word->word && *(es->word->word))
|
||||
|
||||
+17
-20
@@ -1274,6 +1274,11 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
|
||||
|
||||
tcom = (command->type == cm_subshell) ? command->value.Subshell->command : command;
|
||||
|
||||
if (command->flags & CMD_TIME_PIPELINE)
|
||||
tcom->flags |= CMD_TIME_PIPELINE;
|
||||
if (command->flags & CMD_TIME_POSIX)
|
||||
tcom->flags |= CMD_TIME_POSIX;
|
||||
|
||||
/* Make sure the subshell inherits any CMD_IGNORE_RETURN flag. */
|
||||
if ((command->flags & CMD_IGNORE_RETURN) && tcom != command)
|
||||
tcom->flags |= CMD_IGNORE_RETURN;
|
||||
@@ -1360,6 +1365,9 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
|
||||
/* The unwind-protects installed below will take care
|
||||
of closing all of the open file descriptors. */
|
||||
throw_to_top_level ();
|
||||
#if defined (JOB_CONTROL)
|
||||
UNBLOCK_CHILD (oset);
|
||||
#endif
|
||||
return (EXECUTION_FAILURE); /* XXX */
|
||||
}
|
||||
|
||||
@@ -2185,14 +2193,6 @@ execute_case_command (case_command)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Posix.2 specifies that the WORD is tilde expanded. */
|
||||
if (member ('~', case_command->word->word))
|
||||
{
|
||||
word = bash_tilde_expand (case_command->word->word, 0);
|
||||
free (case_command->word->word);
|
||||
case_command->word->word = word;
|
||||
}
|
||||
|
||||
wlist = expand_word_unsplit (case_command->word, 0);
|
||||
word = wlist ? string_list (wlist) : savestring ("");
|
||||
dispose_words (wlist);
|
||||
@@ -2210,15 +2210,6 @@ execute_case_command (case_command)
|
||||
QUIT;
|
||||
for (list = clauses->patterns; list; list = list->next)
|
||||
{
|
||||
/* Posix.2 specifies to tilde expand each member of the pattern
|
||||
list. */
|
||||
if (member ('~', list->word->word))
|
||||
{
|
||||
pattern = bash_tilde_expand (list->word->word, 0);
|
||||
free (list->word->word);
|
||||
list->word->word = pattern;
|
||||
}
|
||||
|
||||
es = expand_word_leave_quoted (list->word, 0);
|
||||
|
||||
if (es && es->word && es->word->word && *(es->word->word))
|
||||
@@ -2508,9 +2499,15 @@ execute_cond_node (cond)
|
||||
}
|
||||
else
|
||||
#endif /* COND_REGEXP */
|
||||
result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP)
|
||||
? EXECUTION_SUCCESS
|
||||
: EXECUTION_FAILURE;
|
||||
{
|
||||
int oe;
|
||||
oe = extended_glob;
|
||||
extended_glob = 1;
|
||||
result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP)
|
||||
? EXECUTION_SUCCESS
|
||||
: EXECUTION_FAILURE;
|
||||
extended_glob = oe;
|
||||
}
|
||||
if (arg1 != nullstr)
|
||||
free (arg1);
|
||||
if (arg2 != nullstr)
|
||||
|
||||
@@ -690,7 +690,9 @@ extern char *get_dirstack_from_string __P((char *));
|
||||
#endif
|
||||
|
||||
static char **bash_tilde_prefixes;
|
||||
static char **bash_tilde_prefixes2;
|
||||
static char **bash_tilde_suffixes;
|
||||
static char **bash_tilde_suffixes2;
|
||||
|
||||
/* If tilde_expand hasn't been able to expand the text, perhaps it
|
||||
is a special shell expansion. This function is installed as the
|
||||
@@ -738,6 +740,10 @@ tilde_initialize ()
|
||||
bash_tilde_prefixes[1] = ":~";
|
||||
bash_tilde_prefixes[2] = (char *)NULL;
|
||||
|
||||
bash_tilde_prefixes2 = strvec_create (2);
|
||||
bash_tilde_prefixes2[0] = ":~";
|
||||
bash_tilde_prefixes2[1] = (char *)NULL;
|
||||
|
||||
tilde_additional_prefixes = bash_tilde_prefixes;
|
||||
|
||||
bash_tilde_suffixes = strvec_create (3);
|
||||
@@ -746,6 +752,10 @@ tilde_initialize ()
|
||||
bash_tilde_suffixes[2] = (char *)NULL;
|
||||
|
||||
tilde_additional_suffixes = bash_tilde_suffixes;
|
||||
|
||||
bash_tilde_suffixes2 = strvec_create (2);
|
||||
bash_tilde_suffixes2[0] = ":";
|
||||
bash_tilde_suffixes2[1] = (char *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -777,9 +787,49 @@ unquoted_tilde_word (s)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Find the end of the tilde-prefix starting at S, and return the tilde
|
||||
prefix in newly-allocated memory. Return the length of the string in
|
||||
*LENP. FLAGS tells whether or not we're in an assignment context --
|
||||
if so, `:' delimits the end of the tilde prefix as well. */
|
||||
char *
|
||||
bash_tilde_find_word (s, flags, lenp)
|
||||
const char *s;
|
||||
int flags, *lenp;
|
||||
{
|
||||
const char *r;
|
||||
char *ret;
|
||||
int l;
|
||||
|
||||
for (r = s; *r && *r != '/'; r++)
|
||||
{
|
||||
/* Short-circuit immediately if we see a quote character. Even though
|
||||
POSIX says that `the first unquoted slash' (or `:') terminates the
|
||||
tilde-prefix, in practice, any quoted portion of the tilde prefix
|
||||
will cause it to not be expanded. */
|
||||
if (*r == '\\' || *r == '\'' || *r == '"')
|
||||
{
|
||||
ret = savestring (s);
|
||||
if (lenp)
|
||||
*lenp = 0;
|
||||
return ret;
|
||||
}
|
||||
else if (flags && *r == ':')
|
||||
break;
|
||||
}
|
||||
l = r - s;
|
||||
ret = xmalloc (l + 1);
|
||||
strncpy (ret, s, l);
|
||||
ret[l] = '\0';
|
||||
if (lenp)
|
||||
*lenp = l;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Tilde-expand S by running it through the tilde expansion library.
|
||||
ASSIGN_P is 1 if this is a variable assignment, so the alternate
|
||||
tilde prefixes should be enabled (`=~' and `:~', see above). */
|
||||
tilde prefixes should be enabled (`=~' and `:~', see above). If
|
||||
ASSIGN_P is 2, we are expanding the rhs of an assignment statement,
|
||||
so `=~' is not valid. */
|
||||
char *
|
||||
bash_tilde_expand (s, assign_p)
|
||||
const char *s;
|
||||
@@ -790,7 +840,12 @@ bash_tilde_expand (s, assign_p)
|
||||
|
||||
old_immed = interrupt_immediately;
|
||||
interrupt_immediately = 1;
|
||||
tilde_additional_prefixes = assign_p ? bash_tilde_prefixes : (char **)0;
|
||||
|
||||
tilde_additional_prefixes = assign_p == 0 ? (char **)0
|
||||
: (assign_p == 2 ? bash_tilde_prefixes2 : bash_tilde_prefixes);
|
||||
if (assign_p == 2)
|
||||
tilde_additional_suffixes = bash_tilde_suffixes2;
|
||||
|
||||
r = (*s == '~') ? unquoted_tilde_word (s) : 1;
|
||||
ret = r ? tilde_expand (s) : savestring (s);
|
||||
interrupt_immediately = old_immed;
|
||||
|
||||
+54
-2
@@ -577,6 +577,7 @@ base_pathname (string)
|
||||
if (absolute_pathname (string) == 0)
|
||||
return (string);
|
||||
#endif
|
||||
|
||||
if (string[0] == '/' && string[1] == 0)
|
||||
return (string);
|
||||
|
||||
@@ -689,7 +690,9 @@ extern char *get_dirstack_from_string __P((char *));
|
||||
#endif
|
||||
|
||||
static char **bash_tilde_prefixes;
|
||||
static char **bash_tilde_prefixes2;
|
||||
static char **bash_tilde_suffixes;
|
||||
static char **bash_tilde_suffixes2;
|
||||
|
||||
/* If tilde_expand hasn't been able to expand the text, perhaps it
|
||||
is a special shell expansion. This function is installed as the
|
||||
@@ -737,6 +740,10 @@ tilde_initialize ()
|
||||
bash_tilde_prefixes[1] = ":~";
|
||||
bash_tilde_prefixes[2] = (char *)NULL;
|
||||
|
||||
bash_tilde_prefixes2 = strvec_create (2);
|
||||
bash_tilde_prefixes2[0] = ":~";
|
||||
bash_tilde_prefixes2[1] = (char *)NULL;
|
||||
|
||||
tilde_additional_prefixes = bash_tilde_prefixes;
|
||||
|
||||
bash_tilde_suffixes = strvec_create (3);
|
||||
@@ -745,6 +752,10 @@ tilde_initialize ()
|
||||
bash_tilde_suffixes[2] = (char *)NULL;
|
||||
|
||||
tilde_additional_suffixes = bash_tilde_suffixes;
|
||||
|
||||
bash_tilde_suffixes2 = strvec_create (2);
|
||||
bash_tilde_suffixes2[0] = ":";
|
||||
bash_tilde_suffixes2[1] = (char *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -776,9 +787,45 @@ unquoted_tilde_word (s)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Find the end of the tilde-prefix starting at S, and return the tilde
|
||||
prefix in newly-allocated memory. Return the length of the string in
|
||||
*LENP. FLAGS tells whether or not we're in an assignment context --
|
||||
if so, `:' delimits the end of the tilde prefix as well. */
|
||||
char *
|
||||
bash_tilde_find_word (s, flags, lenp)
|
||||
const char *s;
|
||||
int flags, *lenp;
|
||||
{
|
||||
const char *r;
|
||||
char *ret;
|
||||
int l;
|
||||
|
||||
for (r = s; *r && *r != '/'; r++)
|
||||
{
|
||||
if (*r == '\\' || *r == '\'' || *r == '"')
|
||||
{
|
||||
ret = savestring (s);
|
||||
if (lenp)
|
||||
*lenp = 0;
|
||||
return ret;
|
||||
}
|
||||
else if (flags && *r == ':')
|
||||
break;
|
||||
}
|
||||
l = r - s;
|
||||
ret = xmalloc (l + 1);
|
||||
strncpy (ret, s, l);
|
||||
ret[l] = '\0';
|
||||
if (lenp)
|
||||
*lenp = l;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Tilde-expand S by running it through the tilde expansion library.
|
||||
ASSIGN_P is 1 if this is a variable assignment, so the alternate
|
||||
tilde prefixes should be enabled (`=~' and `:~', see above). */
|
||||
tilde prefixes should be enabled (`=~' and `:~', see above). If
|
||||
ASSIGN_P is 2, we are expanding the rhs of an assignment statement,
|
||||
so `=~' is not valid. */
|
||||
char *
|
||||
bash_tilde_expand (s, assign_p)
|
||||
const char *s;
|
||||
@@ -789,7 +836,12 @@ bash_tilde_expand (s, assign_p)
|
||||
|
||||
old_immed = interrupt_immediately;
|
||||
interrupt_immediately = 1;
|
||||
tilde_additional_prefixes = assign_p ? bash_tilde_prefixes : (char **)0;
|
||||
|
||||
tilde_additional_prefixes = assign_p == 0 ? (char **)0
|
||||
: (assign_p == 2 ? bash_tilde_prefixes2 : bash_tilde_prefixes);
|
||||
if (assign_p == 2)
|
||||
tilde_additional_suffixes = bash_tilde_suffixes2;
|
||||
|
||||
r = (*s == '~') ? unquoted_tilde_word (s) : 1;
|
||||
ret = r ? tilde_expand (s) : savestring (s);
|
||||
interrupt_immediately = old_immed;
|
||||
|
||||
@@ -303,6 +303,7 @@ extern char *polite_directory_format __P((char *));
|
||||
extern char *extract_colon_unit __P((char *, int *));
|
||||
|
||||
extern void tilde_initialize __P((void));
|
||||
extern char *bash_tilde_find_word __P((const char *, int, int *));
|
||||
extern char *bash_tilde_expand __P((const char *, int));
|
||||
|
||||
extern int group_member __P((gid_t));
|
||||
|
||||
+314
@@ -0,0 +1,314 @@
|
||||
/* general.h -- defines that everybody likes to use. */
|
||||
|
||||
/* Copyright (C) 1993-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. */
|
||||
|
||||
#if !defined (_GENERAL_H_)
|
||||
#define _GENERAL_H_
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
#include "bashtypes.h"
|
||||
|
||||
#if defined (HAVE_SYS_RESOURCE_H) && defined (RLIMTYPE)
|
||||
# if defined (HAVE_SYS_TIME_H)
|
||||
# include <sys/time.h>
|
||||
# endif
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#if defined (HAVE_LIMITS_H)
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#include "xmalloc.h"
|
||||
|
||||
/* NULL pointer type. */
|
||||
#if !defined (NULL)
|
||||
# if defined (__STDC__)
|
||||
# define NULL ((void *) 0)
|
||||
# else
|
||||
# define NULL 0x0
|
||||
# endif /* !__STDC__ */
|
||||
#endif /* !NULL */
|
||||
|
||||
/* Hardly used anymore */
|
||||
#define pointer_to_int(x) (int)((char *)x - (char *)0)
|
||||
|
||||
#if defined (alpha) && defined (__GNUC__) && !defined (strchr) && !defined (__STDC__)
|
||||
extern char *strchr (), *strrchr ();
|
||||
#endif
|
||||
|
||||
#if !defined (strcpy) && (defined (HAVE_DECL_STRCPY) && !HAVE_DECL_STRCPY)
|
||||
extern char *strcpy __P((char *, const char *));
|
||||
#endif
|
||||
|
||||
#if !defined (savestring)
|
||||
# define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x))
|
||||
#endif
|
||||
|
||||
#ifndef member
|
||||
# define member(c, s) ((c) ? ((char *)xstrchr ((s), (c)) != (char *)NULL) : 0)
|
||||
#endif
|
||||
|
||||
#ifndef whitespace
|
||||
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_MAX
|
||||
# ifdef __CHAR_UNSIGNED__
|
||||
# define CHAR_MAX 0xff
|
||||
# else
|
||||
# define CHAR_MAX 0x7f
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
/* Nonzero if the integer type T is signed. */
|
||||
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
|
||||
/* Bound on length of the string representing an integer value of type T.
|
||||
Subtract one for the sign bit if T is signed;
|
||||
302 / 1000 is log10 (2) rounded up;
|
||||
add one for integer division truncation;
|
||||
add one more for a minus sign if t is signed. */
|
||||
#define INT_STRLEN_BOUND(t) \
|
||||
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 \
|
||||
+ 1 + TYPE_SIGNED (t))
|
||||
|
||||
|
||||
/* Define exactly what a legal shell identifier consists of. */
|
||||
#define legal_variable_starter(c) (ISALPHA(c) || (c == '_'))
|
||||
#define legal_variable_char(c) (ISALNUM(c) || c == '_')
|
||||
|
||||
/* Definitions used in subst.c and by the `read' builtin for field
|
||||
splitting. */
|
||||
#define spctabnl(c) ((c) == ' ' || (c) == '\t' || (c) == '\n')
|
||||
|
||||
/* All structs which contain a `next' field should have that field
|
||||
as the first field in the struct. This means that functions
|
||||
can be written to handle the general case for linked lists. */
|
||||
typedef struct g_list {
|
||||
struct g_list *next;
|
||||
} GENERIC_LIST;
|
||||
|
||||
/* Here is a generic structure for associating character strings
|
||||
with integers. It is used in the parser for shell tokenization. */
|
||||
typedef struct {
|
||||
char *word;
|
||||
int token;
|
||||
} STRING_INT_ALIST;
|
||||
|
||||
/* A macro to avoid making an uneccessary function call. */
|
||||
#define REVERSE_LIST(list, type) \
|
||||
((list && list->next) ? (type)list_reverse ((GENERIC_LIST *)list) \
|
||||
: (type)(list))
|
||||
|
||||
#if __GNUC__ > 1
|
||||
# define FASTCOPY(s, d, n) __builtin_memcpy (d, s, n)
|
||||
#else /* !__GNUC__ */
|
||||
# if !defined (HAVE_BCOPY)
|
||||
# if !defined (HAVE_MEMMOVE)
|
||||
# define FASTCOPY(s, d, n) memcpy (d, s, n)
|
||||
# else
|
||||
# define FASTCOPY(s, d, n) memmove (d, s, n)
|
||||
# endif /* !HAVE_MEMMOVE */
|
||||
# else /* HAVE_BCOPY */
|
||||
# define FASTCOPY(s, d, n) bcopy (s, d, n)
|
||||
# endif /* HAVE_BCOPY */
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
/* String comparisons that possibly save a function call each. */
|
||||
#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
|
||||
#define STREQN(a, b, n) ((n == 0) ? (1) \
|
||||
: ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
|
||||
|
||||
/* More convenience definitions that possibly save system or libc calls. */
|
||||
#define STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
|
||||
#define FREE(s) do { if (s) free (s); } while (0)
|
||||
#define MEMBER(c, s) (((c) && c == (s)[0] && !(s)[1]) || (member(c, s)))
|
||||
|
||||
/* A fairly hairy macro to check whether an allocated string has more room,
|
||||
and to resize it using xrealloc if it does not.
|
||||
STR is the string (char *)
|
||||
CIND is the current index into the string (int)
|
||||
ROOM is the amount of additional room we need in the string (int)
|
||||
CSIZE is the currently-allocated size of STR (int)
|
||||
SINCR is how much to increment CSIZE before calling xrealloc (int) */
|
||||
|
||||
#define RESIZE_MALLOCED_BUFFER(str, cind, room, csize, sincr) \
|
||||
do { \
|
||||
if ((cind) + (room) >= csize) \
|
||||
{ \
|
||||
while ((cind) + (room) >= csize) \
|
||||
csize += (sincr); \
|
||||
str = xrealloc (str, csize); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Function pointers can be declared as (Function *)foo. */
|
||||
#if !defined (_FUNCTION_DEF)
|
||||
# define _FUNCTION_DEF
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
typedef char *CPFunction (); /* no longer used */
|
||||
typedef char **CPPFunction (); /* no longer used */
|
||||
#endif /* _FUNCTION_DEF */
|
||||
|
||||
#ifndef SH_FUNCTION_TYPEDEF
|
||||
# define SH_FUNCTION_TYPEDEF
|
||||
|
||||
/* Shell function typedefs with prototypes */
|
||||
/* `Generic' function pointer typedefs */
|
||||
|
||||
typedef int sh_intfunc_t __P((int));
|
||||
typedef int sh_ivoidfunc_t __P((void));
|
||||
typedef int sh_icpfunc_t __P((char *));
|
||||
typedef int sh_icppfunc_t __P((char **));
|
||||
typedef int sh_iptrfunc_t __P((PTR_T));
|
||||
|
||||
typedef void sh_voidfunc_t __P((void));
|
||||
typedef void sh_vintfunc_t __P((int));
|
||||
typedef void sh_vcpfunc_t __P((char *));
|
||||
typedef void sh_vcppfunc_t __P((char **));
|
||||
typedef void sh_vptrfunc_t __P((PTR_T));
|
||||
|
||||
typedef int sh_wdesc_func_t __P((WORD_DESC *));
|
||||
typedef int sh_wlist_func_t __P((WORD_LIST *));
|
||||
|
||||
typedef int sh_glist_func_t __P((GENERIC_LIST *));
|
||||
|
||||
typedef char *sh_string_func_t __P((char *)); /* like savestring, et al. */
|
||||
|
||||
typedef int sh_msg_func_t __P((const char *, ...)); /* printf(3)-like */
|
||||
typedef void sh_vmsg_func_t __P((const char *, ...)); /* printf(3)-like */
|
||||
|
||||
/* Specific function pointer typedefs. Most of these could be done
|
||||
with #defines. */
|
||||
typedef void sh_sv_func_t __P((char *)); /* sh_vcpfunc_t */
|
||||
typedef void sh_free_func_t __P((PTR_T)); /* sh_vptrfunc_t */
|
||||
typedef void sh_resetsig_func_t __P((int)); /* sh_vintfunc_t */
|
||||
|
||||
typedef int sh_ignore_func_t __P((const char *)); /* sh_icpfunc_t */
|
||||
|
||||
typedef int sh_assign_func_t __P((const char *)); /* sh_icpfunc_t */
|
||||
|
||||
typedef int sh_builtin_func_t __P((WORD_LIST *)); /* sh_wlist_func_t */
|
||||
|
||||
#endif /* SH_FUNCTION_TYPEDEF */
|
||||
|
||||
#define NOW ((time_t) time ((time_t *) 0))
|
||||
|
||||
/* Some defines for calling file status functions. */
|
||||
#define FS_EXISTS 0x1
|
||||
#define FS_EXECABLE 0x2
|
||||
#define FS_EXEC_PREFERRED 0x4
|
||||
#define FS_EXEC_ONLY 0x8
|
||||
#define FS_DIRECTORY 0x10
|
||||
#define FS_NODIRS 0x20
|
||||
|
||||
/* Default maximum for move_to_high_fd */
|
||||
#define HIGH_FD_MAX 256
|
||||
|
||||
/* The type of function passed as the fourth argument to qsort(3). */
|
||||
#ifdef __STDC__
|
||||
typedef int QSFUNC (const void *, const void *);
|
||||
#else
|
||||
typedef int QSFUNC ();
|
||||
#endif
|
||||
|
||||
/* Some useful definitions for Unix pathnames. Argument convention:
|
||||
x == string, c == character */
|
||||
|
||||
#if !defined (__CYGWIN__)
|
||||
# define ABSPATH(x) ((x)[0] == '/')
|
||||
# define RELPATH(x) ((x)[0] != '/')
|
||||
#else /* __CYGWIN__ */
|
||||
# define ABSPATH(x) (((x)[0] && ISALPHA((unsigned char)(x)[0]) && (x)[1] == ':' && (x)[2] == '/') || (x)[0] == '/')
|
||||
# define RELPATH(x) (!(x)[0] || ((x)[1] != ':' && (x)[0] != '/'))
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
#define ROOTEDPATH(x) (ABSPATH(x))
|
||||
|
||||
#define DIRSEP '/'
|
||||
#define ISDIRSEP(c) ((c) == '/')
|
||||
#define PATHSEP(c) (ISDIRSEP(c) || (c) == 0)
|
||||
|
||||
#if 0
|
||||
/* Declarations for functions defined in xmalloc.c */
|
||||
extern PTR_T xmalloc __P((size_t));
|
||||
extern PTR_T xrealloc __P((void *, size_t));
|
||||
extern void xfree __P((void *));
|
||||
#endif
|
||||
|
||||
/* Declarations for functions defined in general.c */
|
||||
extern void posix_initialize __P((int));
|
||||
|
||||
#if defined (RLIMTYPE)
|
||||
extern RLIMTYPE string_to_rlimtype __P((char *));
|
||||
extern void print_rlimtype __P((RLIMTYPE, int));
|
||||
#endif
|
||||
|
||||
extern int all_digits __P((char *));
|
||||
extern int legal_number __P((char *, intmax_t *));
|
||||
extern int legal_identifier __P((char *));
|
||||
extern int check_identifier __P((WORD_DESC *, int));
|
||||
extern int legal_alias_name __P((char *, int));
|
||||
extern int assignment __P((const char *, int));
|
||||
|
||||
extern int sh_unset_nodelay_mode __P((int));
|
||||
extern int sh_validfd __P((int));
|
||||
extern void check_dev_tty __P((void));
|
||||
extern int move_to_high_fd __P((int, int, int));
|
||||
extern int check_binary_file __P((char *, int));
|
||||
|
||||
#ifdef _POSIXSTAT_H_
|
||||
extern int same_file __P((char *, char *, struct stat *, struct stat *));
|
||||
#endif
|
||||
|
||||
extern int file_isdir __P((char *));
|
||||
extern int file_iswdir __P((char *));
|
||||
|
||||
extern char *make_absolute __P((char *, char *));
|
||||
extern int absolute_pathname __P((const char *));
|
||||
extern int absolute_program __P((const char *));
|
||||
extern char *base_pathname __P((char *));
|
||||
extern char *full_pathname __P((char *));
|
||||
extern char *polite_directory_format __P((char *));
|
||||
|
||||
extern char *extract_colon_unit __P((char *, int *));
|
||||
|
||||
extern void tilde_initialize __P((void));
|
||||
extern int unquoted_tilde_word __P((const char *));
|
||||
extern char *bash_tilde_find_word __P((const char *, int, int *));
|
||||
extern char *bash_tilde_expand __P((const char *, int));
|
||||
|
||||
extern int group_member __P((gid_t));
|
||||
extern char **get_group_list __P((int *));
|
||||
extern int *get_group_array __P((int *));
|
||||
|
||||
#endif /* _GENERAL_H_ */
|
||||
@@ -1433,7 +1433,9 @@ make_child (command, async_p)
|
||||
|
||||
last_made_pid = pid;
|
||||
|
||||
/* Unblock SIGINT and SIGCHLD. */
|
||||
/* Unblock SIGINT and SIGCHLD unless creating a pipeline, in which case
|
||||
SIGCHLD remains blocked until all commands in the pipeline have been
|
||||
created. */
|
||||
sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -1778,8 +1778,13 @@ raw_job_exit_status (job)
|
||||
if (pipefail_opt)
|
||||
{
|
||||
fail = 0;
|
||||
for (p = jobs[job]->pipe; p->next != jobs[job]->pipe; p = p->next)
|
||||
if (p->status != EXECUTION_SUCCESS) fail = p->status;
|
||||
p = jobs[job]->pipe;
|
||||
do
|
||||
{
|
||||
if (p->status != EXECUTION_SUCCESS) fail = p->status;
|
||||
p = p->next;
|
||||
}
|
||||
while (p != jobs[job]->pipe);
|
||||
return fail;
|
||||
}
|
||||
|
||||
@@ -2311,12 +2316,12 @@ start_job (job, foreground)
|
||||
p = jobs[job]->pipe;
|
||||
|
||||
if (foreground == 0)
|
||||
fprintf (stderr, "[%d]%c ", job + 1,
|
||||
printf ("[%d]%c ", job + 1,
|
||||
(job == current_job) ? '+': ((job == previous_job) ? '-' : ' '));
|
||||
|
||||
do
|
||||
{
|
||||
fprintf (stderr, "%s%s",
|
||||
printf ("%s%s",
|
||||
p->command ? p->command : "",
|
||||
p->next != jobs[job]->pipe? " | " : "");
|
||||
p = p->next;
|
||||
@@ -2324,12 +2329,12 @@ start_job (job, foreground)
|
||||
while (p != jobs[job]->pipe);
|
||||
|
||||
if (foreground == 0)
|
||||
fprintf (stderr, " &");
|
||||
printf (" &");
|
||||
|
||||
if (strcmp (wd, jobs[job]->wd) != 0)
|
||||
fprintf (stderr, " (wd: %s)", polite_directory_format (jobs[job]->wd));
|
||||
printf (" (wd: %s)", polite_directory_format (jobs[job]->wd));
|
||||
|
||||
fprintf (stderr, "\n");
|
||||
printf ("\n");
|
||||
|
||||
/* Run the job. */
|
||||
if (already_running == 0)
|
||||
|
||||
@@ -277,6 +277,39 @@ isolate_tilde_prefix (fname, lenp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Public function to scan a string (FNAME) beginning with a tilde and find
|
||||
the portion of the string that should be passed to the tilde expansion
|
||||
function. Right now, it just calls tilde_find_suffix and allocates new
|
||||
memory, but it can be expanded to do different things later. */
|
||||
char *
|
||||
tilde_find_word (fname, flags, lenp)
|
||||
const char *fname;
|
||||
int flags, *lenp;
|
||||
{
|
||||
int x;
|
||||
char *r;
|
||||
|
||||
x = tilde_find_suffix (fname);
|
||||
if (x == 0)
|
||||
{
|
||||
r = savestring (fname);
|
||||
if (lenp)
|
||||
*lenp = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = (char *)xmalloc (1 + x);
|
||||
strncpy (r, fname, x);
|
||||
r[x] = '\0';
|
||||
if (lenp)
|
||||
*lenp = x;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return a string that is PREFIX concatenated with SUFFIX starting at
|
||||
SUFFIND. */
|
||||
static char *
|
||||
|
||||
@@ -0,0 +1,489 @@
|
||||
/* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). */
|
||||
|
||||
/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Readline, a library for reading lines
|
||||
of text with interactive input and history editing.
|
||||
|
||||
Readline 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.
|
||||
|
||||
Readline 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 Readline; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else /* !HAVE_STRING_H */
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#include "tilde.h"
|
||||
|
||||
#if defined (TEST) || defined (STATIC_MALLOC)
|
||||
static void *xmalloc (), *xrealloc ();
|
||||
#else
|
||||
# include "xmalloc.h"
|
||||
#endif /* TEST || STATIC_MALLOC */
|
||||
|
||||
#if !defined (HAVE_GETPW_DECLS)
|
||||
extern struct passwd *getpwuid PARAMS((uid_t));
|
||||
extern struct passwd *getpwnam PARAMS((const char *));
|
||||
#endif /* !HAVE_GETPW_DECLS */
|
||||
|
||||
#if !defined (savestring)
|
||||
#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
|
||||
#endif /* !savestring */
|
||||
|
||||
#if !defined (NULL)
|
||||
# if defined (__STDC__)
|
||||
# define NULL ((void *) 0)
|
||||
# else
|
||||
# define NULL 0x0
|
||||
# endif /* !__STDC__ */
|
||||
#endif /* !NULL */
|
||||
|
||||
/* If being compiled as part of bash, these will be satisfied from
|
||||
variables.o. If being compiled as part of readline, they will
|
||||
be satisfied from shell.o. */
|
||||
extern char *sh_get_home_dir PARAMS((void));
|
||||
extern char *sh_get_env_value PARAMS((const char *));
|
||||
|
||||
/* The default value of tilde_additional_prefixes. This is set to
|
||||
whitespace preceding a tilde so that simple programs which do not
|
||||
perform any word separation get desired behaviour. */
|
||||
static const char *default_prefixes[] =
|
||||
{ " ~", "\t~", (const char *)NULL };
|
||||
|
||||
/* The default value of tilde_additional_suffixes. This is set to
|
||||
whitespace or newline so that simple programs which do not
|
||||
perform any word separation get desired behaviour. */
|
||||
static const char *default_suffixes[] =
|
||||
{ " ", "\n", (const char *)NULL };
|
||||
|
||||
/* If non-null, this contains the address of a function that the application
|
||||
wants called before trying the standard tilde expansions. The function
|
||||
is called with the text sans tilde, and returns a malloc()'ed string
|
||||
which is the expansion, or a NULL pointer if the expansion fails. */
|
||||
tilde_hook_func_t *tilde_expansion_preexpansion_hook = (tilde_hook_func_t *)NULL;
|
||||
|
||||
/* If non-null, this contains the address of a function to call if the
|
||||
standard meaning for expanding a tilde fails. The function is called
|
||||
with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
|
||||
which is the expansion, or a NULL pointer if there is no expansion. */
|
||||
tilde_hook_func_t *tilde_expansion_failure_hook = (tilde_hook_func_t *)NULL;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which
|
||||
are duplicates for a tilde prefix. Bash uses this to expand
|
||||
`=~' and `:~'. */
|
||||
char **tilde_additional_prefixes = (char **)default_prefixes;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which match
|
||||
the end of a username, instead of just "/". Bash sets this to
|
||||
`:' and `=~'. */
|
||||
char **tilde_additional_suffixes = (char **)default_suffixes;
|
||||
|
||||
static int tilde_find_prefix PARAMS((const char *, int *));
|
||||
static int tilde_find_suffix PARAMS((const char *));
|
||||
static char *isolate_tilde_prefix PARAMS((const char *, int *));
|
||||
static char *glue_prefix_and_suffix PARAMS((char *, const char *, int));
|
||||
|
||||
/* Find the start of a tilde expansion in STRING, and return the index of
|
||||
the tilde which starts the expansion. Place the length of the text
|
||||
which identified this tilde starter in LEN, excluding the tilde itself. */
|
||||
static int
|
||||
tilde_find_prefix (string, len)
|
||||
const char *string;
|
||||
int *len;
|
||||
{
|
||||
register int i, j, string_len;
|
||||
register char **prefixes;
|
||||
|
||||
prefixes = tilde_additional_prefixes;
|
||||
|
||||
string_len = strlen (string);
|
||||
*len = 0;
|
||||
|
||||
if (*string == '\0' || *string == '~')
|
||||
return (0);
|
||||
|
||||
if (prefixes)
|
||||
{
|
||||
for (i = 0; i < string_len; i++)
|
||||
{
|
||||
for (j = 0; prefixes[j]; j++)
|
||||
{
|
||||
if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0)
|
||||
{
|
||||
*len = strlen (prefixes[j]) - 1;
|
||||
return (i + *len);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (string_len);
|
||||
}
|
||||
|
||||
/* Find the end of a tilde expansion in STRING, and return the index of
|
||||
the character which ends the tilde definition. */
|
||||
static int
|
||||
tilde_find_suffix (string)
|
||||
const char *string;
|
||||
{
|
||||
register int i, j, string_len;
|
||||
register char **suffixes;
|
||||
|
||||
suffixes = tilde_additional_suffixes;
|
||||
string_len = strlen (string);
|
||||
|
||||
for (i = 0; i < string_len; i++)
|
||||
{
|
||||
#if defined (__MSDOS__)
|
||||
if (string[i] == '/' || string[i] == '\\' /* || !string[i] */)
|
||||
#else
|
||||
if (string[i] == '/' /* || !string[i] */)
|
||||
#endif
|
||||
break;
|
||||
|
||||
for (j = 0; suffixes && suffixes[j]; j++)
|
||||
{
|
||||
if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0)
|
||||
return (i);
|
||||
}
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Return a new string which is the result of tilde expanding STRING. */
|
||||
char *
|
||||
tilde_expand (string)
|
||||
const char *string;
|
||||
{
|
||||
char *result;
|
||||
int result_size, result_index;
|
||||
|
||||
result_index = result_size = 0;
|
||||
if (result = strchr (string, '~'))
|
||||
result = (char *)xmalloc (result_size = (strlen (string) + 16));
|
||||
else
|
||||
result = (char *)xmalloc (result_size = (strlen (string) + 1));
|
||||
|
||||
/* Scan through STRING expanding tildes as we come to them. */
|
||||
while (1)
|
||||
{
|
||||
register int start, end;
|
||||
char *tilde_word, *expansion;
|
||||
int len;
|
||||
|
||||
/* Make START point to the tilde which starts the expansion. */
|
||||
start = tilde_find_prefix (string, &len);
|
||||
|
||||
/* Copy the skipped text into the result. */
|
||||
if ((result_index + start + 1) > result_size)
|
||||
result = (char *)xrealloc (result, 1 + (result_size += (start + 20)));
|
||||
|
||||
strncpy (result + result_index, string, start);
|
||||
result_index += start;
|
||||
|
||||
/* Advance STRING to the starting tilde. */
|
||||
string += start;
|
||||
|
||||
/* Make END be the index of one after the last character of the
|
||||
username. */
|
||||
end = tilde_find_suffix (string);
|
||||
|
||||
/* If both START and END are zero, we are all done. */
|
||||
if (!start && !end)
|
||||
break;
|
||||
|
||||
/* Expand the entire tilde word, and copy it into RESULT. */
|
||||
tilde_word = (char *)xmalloc (1 + end);
|
||||
strncpy (tilde_word, string, end);
|
||||
tilde_word[end] = '\0';
|
||||
string += end;
|
||||
|
||||
expansion = tilde_expand_word (tilde_word);
|
||||
free (tilde_word);
|
||||
|
||||
len = strlen (expansion);
|
||||
#ifdef __CYGWIN__
|
||||
/* Fix for Cygwin to prevent ~user/xxx from expanding to //xxx when
|
||||
$HOME for `user' is /. On cygwin, // denotes a network drive. */
|
||||
if (len > 1 || *expansion != '/' || *string != '/')
|
||||
#endif
|
||||
{
|
||||
if ((result_index + len + 1) > result_size)
|
||||
result = (char *)xrealloc (result, 1 + (result_size += (len + 20)));
|
||||
|
||||
strcpy (result + result_index, expansion);
|
||||
result_index += len;
|
||||
}
|
||||
free (expansion);
|
||||
}
|
||||
|
||||
result[result_index] = '\0';
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Take FNAME and return the tilde prefix we want expanded. If LENP is
|
||||
non-null, the index of the end of the prefix into FNAME is returned in
|
||||
the location it points to. */
|
||||
static char *
|
||||
isolate_tilde_prefix (fname, lenp)
|
||||
const char *fname;
|
||||
int *lenp;
|
||||
{
|
||||
char *ret;
|
||||
int i;
|
||||
|
||||
ret = (char *)xmalloc (strlen (fname));
|
||||
#if defined (__MSDOS__)
|
||||
for (i = 1; fname[i] && fname[i] != '/' && fname[i] != '\\'; i++)
|
||||
#else
|
||||
for (i = 1; fname[i] && fname[i] != '/'; i++)
|
||||
#endif
|
||||
ret[i - 1] = fname[i];
|
||||
ret[i - 1] = '\0';
|
||||
if (lenp)
|
||||
*lenp = i;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Public function to scan a string (FNAME) beginning with a tilde and find
|
||||
the portion of the string that should be passed to the tilde expansion
|
||||
function. Right now, it just calls tilde_find_suffix and allocates new
|
||||
memory, but it can be expanded to do different things later. */
|
||||
char *
|
||||
tilde_find_word (fname, flags, lenp)
|
||||
const char *fname;
|
||||
int flags, *lenp;
|
||||
{
|
||||
int x;
|
||||
char *r;
|
||||
|
||||
x = tilde_find_suffix (fname);
|
||||
if (x == 0)
|
||||
{
|
||||
r = savestring (fname);
|
||||
if (lenp)
|
||||
*lenp = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = (char *)xmalloc (1 + x);
|
||||
strncpy (r, fname, x);
|
||||
r[x] = '\0';
|
||||
if (lenp)
|
||||
*lenp = x;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Return a string that is PREFIX concatenated with SUFFIX starting at
|
||||
SUFFIND. */
|
||||
static char *
|
||||
glue_prefix_and_suffix (prefix, suffix, suffind)
|
||||
char *prefix;
|
||||
const char *suffix;
|
||||
int suffind;
|
||||
{
|
||||
char *ret;
|
||||
int plen, slen;
|
||||
|
||||
plen = (prefix && *prefix) ? strlen (prefix) : 0;
|
||||
slen = strlen (suffix + suffind);
|
||||
ret = (char *)xmalloc (plen + slen + 1);
|
||||
if (plen)
|
||||
strcpy (ret, prefix);
|
||||
strcpy (ret + plen, suffix + suffind);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
|
||||
tilde. If there is no expansion, call tilde_expansion_failure_hook.
|
||||
This always returns a newly-allocated string, never static storage. */
|
||||
char *
|
||||
tilde_expand_word (filename)
|
||||
const char *filename;
|
||||
{
|
||||
char *dirname, *expansion, *username;
|
||||
int user_len;
|
||||
struct passwd *user_entry;
|
||||
|
||||
if (filename == 0)
|
||||
return ((char *)NULL);
|
||||
|
||||
if (*filename != '~')
|
||||
return (savestring (filename));
|
||||
|
||||
/* A leading `~/' or a bare `~' is *always* translated to the value of
|
||||
$HOME or the home directory of the current user, regardless of any
|
||||
preexpansion hook. */
|
||||
if (filename[1] == '\0' || filename[1] == '/')
|
||||
{
|
||||
/* Prefix $HOME to the rest of the string. */
|
||||
expansion = sh_get_env_value ("HOME");
|
||||
|
||||
/* If there is no HOME variable, look up the directory in
|
||||
the password database. */
|
||||
if (expansion == 0)
|
||||
expansion = sh_get_home_dir ();
|
||||
|
||||
return (glue_prefix_and_suffix (expansion, filename, 1));
|
||||
}
|
||||
|
||||
username = isolate_tilde_prefix (filename, &user_len);
|
||||
|
||||
if (tilde_expansion_preexpansion_hook)
|
||||
{
|
||||
expansion = (*tilde_expansion_preexpansion_hook) (username);
|
||||
if (expansion)
|
||||
{
|
||||
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
|
||||
free (username);
|
||||
free (expansion);
|
||||
return (dirname);
|
||||
}
|
||||
}
|
||||
|
||||
/* No preexpansion hook, or the preexpansion hook failed. Look in the
|
||||
password database. */
|
||||
dirname = (char *)NULL;
|
||||
user_entry = getpwnam (username);
|
||||
if (user_entry == 0)
|
||||
{
|
||||
/* If the calling program has a special syntax for expanding tildes,
|
||||
and we couldn't find a standard expansion, then let them try. */
|
||||
if (tilde_expansion_failure_hook)
|
||||
{
|
||||
expansion = (*tilde_expansion_failure_hook) (username);
|
||||
if (expansion)
|
||||
{
|
||||
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
|
||||
free (expansion);
|
||||
}
|
||||
}
|
||||
free (username);
|
||||
/* If we don't have a failure hook, or if the failure hook did not
|
||||
expand the tilde, return a copy of what we were passed. */
|
||||
if (dirname == 0)
|
||||
dirname = savestring (filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
free (username);
|
||||
dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
|
||||
}
|
||||
|
||||
endpwent ();
|
||||
return (dirname);
|
||||
}
|
||||
|
||||
|
||||
#if defined (TEST)
|
||||
#undef NULL
|
||||
#include <stdio.h>
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *result, line[512];
|
||||
int done = 0;
|
||||
|
||||
while (!done)
|
||||
{
|
||||
printf ("~expand: ");
|
||||
fflush (stdout);
|
||||
|
||||
if (!gets (line))
|
||||
strcpy (line, "done");
|
||||
|
||||
if ((strcmp (line, "done") == 0) ||
|
||||
(strcmp (line, "quit") == 0) ||
|
||||
(strcmp (line, "exit") == 0))
|
||||
{
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
result = tilde_expand (line);
|
||||
printf (" --> %s\n", result);
|
||||
free (result);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static void memory_error_and_abort ();
|
||||
|
||||
static void *
|
||||
xmalloc (bytes)
|
||||
size_t bytes;
|
||||
{
|
||||
void *temp = (char *)malloc (bytes);
|
||||
|
||||
if (!temp)
|
||||
memory_error_and_abort ();
|
||||
return (temp);
|
||||
}
|
||||
|
||||
static void *
|
||||
xrealloc (pointer, bytes)
|
||||
void *pointer;
|
||||
int bytes;
|
||||
{
|
||||
void *temp;
|
||||
|
||||
if (!pointer)
|
||||
temp = malloc (bytes);
|
||||
else
|
||||
temp = realloc (pointer, bytes);
|
||||
|
||||
if (!temp)
|
||||
memory_error_and_abort ();
|
||||
|
||||
return (temp);
|
||||
}
|
||||
|
||||
static void
|
||||
memory_error_and_abort ()
|
||||
{
|
||||
fprintf (stderr, "readline: out of virtual memory\n");
|
||||
abort ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* compile-command: "gcc -g -DTEST -o tilde tilde.c"
|
||||
* end:
|
||||
*/
|
||||
#endif /* TEST */
|
||||
@@ -71,6 +71,9 @@ extern char *tilde_expand PARAMS((const char *));
|
||||
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
|
||||
extern char *tilde_expand_word PARAMS((const char *));
|
||||
|
||||
/* Find the portion of the string beginning with ~ that should be expanded. */
|
||||
extern char *tilde_find_word PARAMS((const char *, int, int *));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/* tilde.h: Externally available variables and function in libtilde.a. */
|
||||
|
||||
/* Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the Readline Library (the Library), a set of
|
||||
routines for providing Emacs style line input to programs that ask
|
||||
for it.
|
||||
|
||||
The Library 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.
|
||||
|
||||
The Library 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.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
|
||||
#if !defined (_TILDE_H_)
|
||||
# define _TILDE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* A function can be defined using prototypes and compile on both ANSI C
|
||||
and traditional C compilers with something like this:
|
||||
extern char *func PARAMS((char *, char *, int)); */
|
||||
|
||||
#if !defined (PARAMS)
|
||||
# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
|
||||
# define PARAMS(protos) protos
|
||||
# else
|
||||
# define PARAMS(protos) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef char *tilde_hook_func_t PARAMS((char *));
|
||||
|
||||
/* If non-null, this contains the address of a function that the application
|
||||
wants called before trying the standard tilde expansions. The function
|
||||
is called with the text sans tilde, and returns a malloc()'ed string
|
||||
which is the expansion, or a NULL pointer if the expansion fails. */
|
||||
extern tilde_hook_func_t *tilde_expansion_preexpansion_hook;
|
||||
|
||||
/* If non-null, this contains the address of a function to call if the
|
||||
standard meaning for expanding a tilde fails. The function is called
|
||||
with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
|
||||
which is the expansion, or a NULL pointer if there is no expansion. */
|
||||
extern tilde_hook_func_t *tilde_expansion_failure_hook;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which
|
||||
are duplicates for a tilde prefix. Bash uses this to expand
|
||||
`=~' and `:~'. */
|
||||
extern char **tilde_additional_prefixes;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which match
|
||||
the end of a username, instead of just "/". Bash sets this to
|
||||
`:' and `=~'. */
|
||||
extern char **tilde_additional_suffixes;
|
||||
|
||||
/* Return a new string which is the result of tilde expanding STRING. */
|
||||
extern char *tilde_expand PARAMS((const char *));
|
||||
|
||||
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
|
||||
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
|
||||
extern char *tilde_expand_word PARAMS((const char *));
|
||||
|
||||
/* Find the portion of the string beginning with ~ that should be expanded. */
|
||||
extern char *tilde_find_word PARAMS((const char *, int *));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TILDE_H_ */
|
||||
+320
-291
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+422
-375
File diff suppressed because it is too large
Load Diff
+4349
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+420
-373
File diff suppressed because it is too large
Load Diff
+4283
File diff suppressed because it is too large
Load Diff
@@ -1528,7 +1528,7 @@ split_at_delims (string, slen, delims, sentinel, nwp, cwp)
|
||||
mblength = MBRLEN (delims + i, slength, &state);
|
||||
if (MB_INVALIDCH (mblength))
|
||||
state = state_bak;
|
||||
else if (mblength != 1)
|
||||
else if (mblength > 1)
|
||||
{
|
||||
memcpy (d2 + ts, delims + i, mblength);
|
||||
ts += mblength;
|
||||
@@ -1793,6 +1793,8 @@ string_list_dollar_at (list, quoted)
|
||||
sep[0] = *ifs;
|
||||
sep[1] = '\0';
|
||||
}
|
||||
else if (mblength == 0)
|
||||
sep[0] = '\0';
|
||||
else
|
||||
{
|
||||
memcpy (sep, ifs, mblength);
|
||||
@@ -2161,14 +2163,7 @@ do_assignment_internal (string, expand)
|
||||
|
||||
/* Perform tilde expansion. */
|
||||
if (expand && temp[0])
|
||||
{
|
||||
temp = (xstrchr (temp, '~') && unquoted_member ('~', temp))
|
||||
? bash_tilde_expand (temp, 1)
|
||||
: savestring (temp);
|
||||
|
||||
value = expand_string_if_necessary (temp, 0, expand_string_unsplit);
|
||||
free (temp);
|
||||
}
|
||||
value = expand_string_if_necessary (temp, 0, expand_string_assignment);
|
||||
else
|
||||
value = savestring (temp);
|
||||
}
|
||||
@@ -2336,9 +2331,6 @@ 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));
|
||||
@@ -2347,7 +2339,6 @@ pos_params (string, start, end, quoted)
|
||||
else
|
||||
ret = string_list (h);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
ret = string_list ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? quote_list (h) : h);
|
||||
if (t != params)
|
||||
@@ -2364,9 +2355,9 @@ pos_params (string, start, end, quoted)
|
||||
/******************************************************************/
|
||||
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
#define EXP_CHAR(s) (s == '$' || s == '`' || s == '<' || s == '>' || s == CTLESC)
|
||||
#define EXP_CHAR(s) (s == '$' || s == '`' || s == '<' || s == '>' || s == CTLESC || s == '~')
|
||||
#else
|
||||
#define EXP_CHAR(s) (s == '$' || s == '`' || s == CTLESC)
|
||||
#define EXP_CHAR(s) (s == '$' || s == '`' || s == CTLESC || s == '~')
|
||||
#endif
|
||||
|
||||
/* If there are any characters in STRING that require full expansion,
|
||||
@@ -2493,13 +2484,6 @@ cond_expand_word (w, special)
|
||||
if (w->word == 0 || w->word[0] == '\0')
|
||||
return ((char *)NULL);
|
||||
|
||||
if (xstrchr (w->word, '~') && unquoted_member ('~', w->word))
|
||||
{
|
||||
p = bash_tilde_expand (w->word, 0);
|
||||
free (w->word);
|
||||
w->word = p;
|
||||
}
|
||||
|
||||
l = call_expand_word_internal (w, 0, 0, (int *)0, (int *)0);
|
||||
if (l)
|
||||
{
|
||||
@@ -2599,6 +2583,36 @@ expand_string_unsplit (string, quoted)
|
||||
return (value);
|
||||
}
|
||||
|
||||
/* Expand the rhs of an assignment statement */
|
||||
WORD_LIST *
|
||||
expand_string_assignment (string, quoted)
|
||||
char *string;
|
||||
int quoted;
|
||||
{
|
||||
WORD_DESC td;
|
||||
WORD_LIST *value;
|
||||
|
||||
if (string == 0 || *string == '\0')
|
||||
return ((WORD_LIST *)NULL);
|
||||
|
||||
expand_no_split_dollar_star = 1;
|
||||
|
||||
td.flags = W_ASSIGNRHS;
|
||||
td.word = savestring (string);
|
||||
value = call_expand_word_internal (&td, quoted, 0, (int *)NULL, (int *)NULL);
|
||||
FREE (td.word);
|
||||
|
||||
expand_no_split_dollar_star = 0;
|
||||
|
||||
if (value)
|
||||
{
|
||||
if (value->word)
|
||||
remove_quoted_nulls (value->word->word);
|
||||
dequote_list (value);
|
||||
}
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
||||
/* Expand one of the PS? prompt strings. This is a sort of combination of
|
||||
expand_string_unsplit and expand_string_internal, but returns the
|
||||
@@ -3555,8 +3569,6 @@ getpattern (value, quoted, expandpat)
|
||||
WORD_LIST *l;
|
||||
int i;
|
||||
|
||||
tword = xstrchr (value, '~') ? bash_tilde_expand (value, 0) : savestring (value);
|
||||
|
||||
/* There is a problem here: how to handle single or double quotes in the
|
||||
pattern string when the whole expression is between double quotes?
|
||||
POSIX.2 says that enclosing double quotes do not cause the pattern to
|
||||
@@ -3574,11 +3586,10 @@ getpattern (value, quoted, expandpat)
|
||||
|
||||
/* expand_string_for_rhs () leaves WORD quoted and does not perform
|
||||
word splitting. */
|
||||
l = *tword ? expand_string_for_rhs (tword,
|
||||
l = *value ? expand_string_for_rhs (value,
|
||||
(quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? Q_PATQUOTE : quoted,
|
||||
(int *)NULL, (int *)NULL)
|
||||
: (WORD_LIST *)0;
|
||||
free (tword);
|
||||
pat = string_list (l);
|
||||
dispose_words (l);
|
||||
if (pat)
|
||||
@@ -3626,11 +3637,7 @@ 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);
|
||||
|
||||
@@ -4707,24 +4714,16 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
|
||||
char *t, *t1, *temp;
|
||||
int hasdol;
|
||||
|
||||
/* XXX - Should we tilde expand in an assignment context if C is `='? */
|
||||
if (*value == '~')
|
||||
temp = bash_tilde_expand (value, 0);
|
||||
else if (xstrchr (value, '~') && unquoted_substring ("=~", value))
|
||||
temp = bash_tilde_expand (value, 1);
|
||||
else
|
||||
temp = savestring (value);
|
||||
|
||||
/* If the entire expression is between double quotes, we want to treat
|
||||
the value as a double-quoted string, with the exception that we strip
|
||||
embedded unescaped double quotes. */
|
||||
if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *temp)
|
||||
if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *value)
|
||||
{
|
||||
hasdol = 0;
|
||||
t = string_extract_double_quoted (temp, &hasdol, 1);
|
||||
free (temp);
|
||||
temp = t;
|
||||
temp = string_extract_double_quoted (value, &hasdol, 1);
|
||||
}
|
||||
else
|
||||
temp = value;
|
||||
|
||||
hasdol = 0;
|
||||
/* XXX was 0 not quoted */
|
||||
@@ -4732,7 +4731,8 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
|
||||
: (WORD_LIST *)0;
|
||||
if (hasdollarat)
|
||||
*hasdollarat = hasdol || (l && l->next);
|
||||
free (temp);
|
||||
if (temp != value)
|
||||
free (temp);
|
||||
if (l)
|
||||
{
|
||||
/* The expansion of TEMP returned something. We need to treat things
|
||||
@@ -4792,15 +4792,7 @@ parameter_brace_expand_error (name, value)
|
||||
|
||||
if (value && *value)
|
||||
{
|
||||
if (*value == '~')
|
||||
temp = bash_tilde_expand (value, 0);
|
||||
else if (xstrchr (value, '~') && unquoted_substring ("=~", value))
|
||||
temp = bash_tilde_expand (value, 1);
|
||||
else
|
||||
temp = savestring (value);
|
||||
|
||||
l = expand_string (temp, 0);
|
||||
FREE (temp);
|
||||
l = expand_string (value, 0);
|
||||
temp = string_list (l);
|
||||
report_error ("%s: %s", name, temp ? temp : ""); /* XXX was value not "" */
|
||||
FREE (temp);
|
||||
@@ -5454,16 +5446,9 @@ parameter_brace_patsub (varname, value, patsub, quoted)
|
||||
if (rep && *rep == '\0')
|
||||
rep = (char *)NULL;
|
||||
|
||||
#if 0
|
||||
/* Expand PAT and REP for command, variable and parameter, arithmetic,
|
||||
and process substitution. Also perform quote removal. Do not
|
||||
perform word splitting or filename generation. */
|
||||
pat = expand_string_if_necessary (lpatsub, (quoted & ~Q_DOUBLE_QUOTES), expand_string_unsplit);
|
||||
#else
|
||||
/* Perform the same expansions on the pattern as performed by the
|
||||
pattern removal expansions. */
|
||||
pat = getpattern (lpatsub, quoted, 1);
|
||||
#endif
|
||||
|
||||
if (rep)
|
||||
{
|
||||
@@ -6029,11 +6014,7 @@ 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;
|
||||
@@ -6319,10 +6300,13 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin
|
||||
string (e.g., "xx"ab), or is fully quoted (e.g., "xxab"). */
|
||||
int quoted_state;
|
||||
|
||||
/* State flags */
|
||||
int had_quoted_null;
|
||||
int has_dollar_at;
|
||||
int tflag;
|
||||
|
||||
int assignoff; /* If assignment, offset of `=' */
|
||||
|
||||
register unsigned char c; /* Current character. */
|
||||
int t_index; /* For calls to string_extract_xxx. */
|
||||
|
||||
@@ -6343,6 +6327,8 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin
|
||||
if (contains_dollar_at)
|
||||
*contains_dollar_at = 0;
|
||||
|
||||
assignoff = -1;
|
||||
|
||||
/* Begin the expansion. */
|
||||
|
||||
for (sindex = 0; ;)
|
||||
@@ -6412,6 +6398,81 @@ add_string:
|
||||
}
|
||||
#endif /* PROCESS_SUBSTITUTION */
|
||||
|
||||
case '=':
|
||||
/* Posix.2 section 3.6.1 says that tildes following `=' in words
|
||||
which are not assignment statements are not expanded. If the
|
||||
shell isn't in posix mode, though, we perform tilde expansion
|
||||
on `likely candidate' unquoted assignment statements (flags
|
||||
include W_ASSIGNMENT but not W_QUOTED). A likely candidate
|
||||
contains an unquoted :~ or =~. Something to think about: we
|
||||
now have a flag that says to perform tilde expansion on arguments
|
||||
to `assignment builtins' like declare and export that look like
|
||||
assignment statements. We now do tilde expansion on such words
|
||||
even in POSIX mode. */
|
||||
if (word->flags & (W_ASSIGNRHS|W_NOTILDE))
|
||||
goto add_character;
|
||||
/* If we're not in posix mode or forcing assignment-statement tilde
|
||||
expansion, note where the `=' appears in the word and prepare to
|
||||
do tilde expansion following the first `='. */
|
||||
if ((word->flags & W_ASSIGNMENT) &&
|
||||
(posixly_correct == 0 || (word->flags & W_TILDEEXP)) &&
|
||||
assignoff == -1 && sindex > 0)
|
||||
assignoff = sindex;
|
||||
if (sindex == assignoff && string[sindex+1] == '~') /* XXX */
|
||||
word->flags |= W_ITILDE;
|
||||
else if ((word->flags & W_ASSIGNMENT) &&
|
||||
(posixly_correct == 0 || (word->flags & W_TILDEEXP)) &&
|
||||
string[sindex+1] == '~')
|
||||
word->flags |= W_ITILDE;
|
||||
goto add_character;
|
||||
|
||||
case ':':
|
||||
if (word->flags & W_NOTILDE)
|
||||
goto add_character;
|
||||
if ((word->flags & (W_ASSIGNMENT|W_ASSIGNRHS)) &&
|
||||
(posixly_correct == 0 || (word->flags & W_TILDEEXP)) &&
|
||||
string[sindex+1] == '~')
|
||||
word->flags |= W_ITILDE;
|
||||
goto add_character;
|
||||
|
||||
case '~':
|
||||
/* If the word isn't supposed to be tilde expanded, or we're not
|
||||
at the start of a word or after an unquoted : or = in an
|
||||
assignment statement, we don't do tilde expansion. */
|
||||
if ((word->flags & W_NOTILDE) ||
|
||||
(sindex > 0 && ((word->flags & W_ITILDE) == 0)) ||
|
||||
(quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
|
||||
{
|
||||
word->flags &= ~W_ITILDE;
|
||||
goto add_character;
|
||||
}
|
||||
|
||||
if (word->flags & W_ASSIGNRHS)
|
||||
tflag = 2;
|
||||
else if ((word->flags & W_ASSIGNMENT) &&
|
||||
(posixly_correct == 0 || (word->flags & W_TILDEEXP)))
|
||||
tflag = 1;
|
||||
else
|
||||
tflag = 0;
|
||||
|
||||
temp = bash_tilde_find_word (string + sindex, tflag, &t_index);
|
||||
|
||||
word->flags &= ~W_ITILDE;
|
||||
|
||||
if (temp && *temp && t_index > 0)
|
||||
{
|
||||
temp1 = bash_tilde_expand (temp, tflag);
|
||||
free (temp);
|
||||
temp = temp1;
|
||||
sindex += t_index;
|
||||
goto add_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
FREE (temp);
|
||||
goto add_character;
|
||||
}
|
||||
|
||||
case '$':
|
||||
if (expanded_something)
|
||||
*expanded_something = 1;
|
||||
@@ -6498,11 +6559,7 @@ add_twochars:
|
||||
break;
|
||||
|
||||
case '"':
|
||||
#if 0
|
||||
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT|Q_PATQUOTE))
|
||||
#else
|
||||
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
|
||||
#endif
|
||||
goto add_character;
|
||||
|
||||
t_index = ++sindex;
|
||||
@@ -6644,11 +6701,7 @@ add_twochars:
|
||||
/* break; */
|
||||
|
||||
case '\'':
|
||||
#if 0
|
||||
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT|Q_PATQUOTE))
|
||||
#else
|
||||
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
|
||||
#endif
|
||||
goto add_character;
|
||||
|
||||
t_index = ++sindex;
|
||||
@@ -6968,7 +7021,7 @@ setifs (v)
|
||||
size_t ifs_len;
|
||||
ifs_len = strnlen (ifs_value, MB_CUR_MAX);
|
||||
ifs_firstc_len = MBLEN (ifs_value, ifs_len);
|
||||
if (ifs_firstc_len == 1 || MB_INVALIDCH (ifs_firstc_len))
|
||||
if (ifs_firstc_len == 1 || ifs_firstc_len == 0 || MB_INVALIDCH (ifs_firstc_len))
|
||||
{
|
||||
ifs_firstc[0] = ifs_value[0];
|
||||
ifs_firstc[1] = '\0';
|
||||
@@ -7382,29 +7435,6 @@ shell_expand_word_list (tlist, eflags)
|
||||
|
||||
next = tlist->next;
|
||||
|
||||
/* Posix.2 section 3.6.1 says that tildes following `=' in words
|
||||
which are not assignment statements are not expanded. If the
|
||||
shell isn't in posix mode, though, we perform tilde expansion
|
||||
on `likely candidate' unquoted assignment statements (flags
|
||||
include W_ASSIGNMENT but not W_QUOTED). A likely candidate
|
||||
contains an unquoted :~ or =~. Something to think about: we
|
||||
now have a flag that says to perform tilde expansion on arguments
|
||||
to `assignment builtins' like declare and export that look like
|
||||
assignment statements. We now do tilde expansion on such words
|
||||
even in POSIX mode. */
|
||||
if (((tlist->word->flags & (W_ASSIGNMENT|W_QUOTED)) == W_ASSIGNMENT) &&
|
||||
(posixly_correct == 0 || (tlist->word->flags & W_TILDEEXP)) &&
|
||||
(unquoted_substring ("=~", temp_string) || unquoted_substring (":~", temp_string)))
|
||||
{
|
||||
tlist->word->word = bash_tilde_expand (temp_string, 1);
|
||||
free (temp_string);
|
||||
}
|
||||
else if (temp_string[0] == '~')
|
||||
{
|
||||
tlist->word->word = bash_tilde_expand (temp_string, 0);
|
||||
free (temp_string);
|
||||
}
|
||||
|
||||
expanded_something = 0;
|
||||
expanded = expand_word_internal
|
||||
(tlist->word, 0, 0, &has_dollar_at, &expanded_something);
|
||||
|
||||
+239
-29
@@ -124,7 +124,13 @@ pid_t current_command_subst_pid = NO_PID;
|
||||
SHELL_VAR *ifs_var;
|
||||
char *ifs_value;
|
||||
unsigned char ifs_cmap[UCHAR_MAX + 1];
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
unsigned char ifs_firstc[MB_LEN_MAX];
|
||||
size_t ifs_firstc_len;
|
||||
#else
|
||||
unsigned char ifs_firstc;
|
||||
#endif
|
||||
|
||||
/* Extern functions and variables from different files. */
|
||||
extern int last_command_exit_value, last_command_exit_signal;
|
||||
@@ -138,6 +144,7 @@ extern char *this_command_name;
|
||||
extern struct fd_bitmap *current_fds_to_close;
|
||||
extern int wordexp_only;
|
||||
extern int expanding_redir;
|
||||
extern int tempenv_assign_error;
|
||||
|
||||
/* Non-zero means to allow unmatched globbed filenames to expand to
|
||||
a null file. */
|
||||
@@ -699,9 +706,16 @@ add_one_character:
|
||||
|
||||
for (t = 0; ret[t]; t++, j++)
|
||||
temp[j] = ret[t];
|
||||
temp[j++] = string[si];
|
||||
temp[j] = string[si];
|
||||
|
||||
if (string[si])
|
||||
{
|
||||
j++;
|
||||
i = si + 1;
|
||||
}
|
||||
else
|
||||
i = si;
|
||||
|
||||
i = si + 1;
|
||||
if (free_ret)
|
||||
free (ret);
|
||||
continue;
|
||||
@@ -777,7 +791,7 @@ skip_double_quoted (string, slen, sind)
|
||||
{
|
||||
si = i + 2;
|
||||
if (string[i + 1] == LPAREN)
|
||||
ret = extract_delimited_string (string, &si, "$(", "(", ")", EX_NOALLOC);
|
||||
ret = extract_delimited_string (string, &si, "$(", "(", ")", EX_NOALLOC); /* ) */
|
||||
else
|
||||
ret = extract_dollar_brace_string (string, &si, 0, EX_NOALLOC);
|
||||
|
||||
@@ -854,8 +868,14 @@ string_extract_verbatim (string, sindex, charlist)
|
||||
char *charlist;
|
||||
{
|
||||
register int i = *sindex;
|
||||
size_t slen;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
size_t clen;
|
||||
wchar_t *wcharlist;
|
||||
#endif
|
||||
int c;
|
||||
char *temp;
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
if (charlist[0] == '\'' && charlist[1] == '\0')
|
||||
{
|
||||
@@ -864,18 +884,62 @@ string_extract_verbatim (string, sindex, charlist)
|
||||
return temp;
|
||||
}
|
||||
|
||||
for (i = *sindex; c = string[i]; i++)
|
||||
slen = strlen (string + *sindex) + *sindex;
|
||||
i = *sindex;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
clen = strlen (charlist);
|
||||
wcharlist = 0;
|
||||
#endif
|
||||
while (c = string[i])
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
size_t mblength;
|
||||
#endif
|
||||
if (c == CTLESC)
|
||||
{
|
||||
i++;
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
mblength = MBLEN (string + i, slen - 1);
|
||||
if (mblength > 1)
|
||||
{
|
||||
wchar_t wc;
|
||||
mblength = mbtowc (&wc, string + i, slen - i);
|
||||
if (MB_INVALIDCH (mblength))
|
||||
{
|
||||
if (MEMBER (c, charlist))
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wcharlist == 0)
|
||||
{
|
||||
size_t len;
|
||||
len = mbstowcs (wcharlist, charlist, 0);
|
||||
if (len == -1)
|
||||
len = 0;
|
||||
wcharlist = xmalloc ((sizeof (wchar_t) * len) + 1);
|
||||
mbstowcs (wcharlist, charlist, len);
|
||||
}
|
||||
|
||||
if (wcschr (wcharlist, wc))
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (MEMBER (c, charlist))
|
||||
break;
|
||||
|
||||
ADVANCE_CHAR (string, slen, i);
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
FREE (wcharlist);
|
||||
#endif
|
||||
|
||||
temp = substring (string, *sindex, i);
|
||||
*sindex = i;
|
||||
|
||||
@@ -884,13 +948,13 @@ string_extract_verbatim (string, sindex, charlist)
|
||||
|
||||
/* Extract the $( construct in STRING, and return a new string.
|
||||
Start extracting at (SINDEX) as if we had just seen "$(".
|
||||
Make (SINDEX) get the position of the matching ")". */
|
||||
Make (SINDEX) get the position of the matching ")". ) */
|
||||
char *
|
||||
extract_command_subst (string, sindex)
|
||||
char *string;
|
||||
int *sindex;
|
||||
{
|
||||
return (extract_delimited_string (string, sindex, "$(", "(", ")", 0));
|
||||
return (extract_delimited_string (string, sindex, "$(", "(", ")", 0)); /*)*/
|
||||
}
|
||||
|
||||
/* Extract the $[ construct in STRING, and return a new string. (])
|
||||
@@ -1448,11 +1512,36 @@ split_at_delims (string, slen, delims, sentinel, nwp, cwp)
|
||||
d2 = 0;
|
||||
if (delims)
|
||||
{
|
||||
d2 = (char *)xmalloc (strlen (delims) + 1);
|
||||
for (i = ts = 0; delims[i]; i++)
|
||||
size_t slength;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
size_t mblength = 1;
|
||||
#endif
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
slength = strlen (delims);
|
||||
d2 = (char *)xmalloc (slength + 1);
|
||||
i = ts = 0;
|
||||
while (delims[i])
|
||||
{
|
||||
if (whitespace(delims[i]) == 0)
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
mbstate_t state_bak = state;
|
||||
mblength = MBRLEN (delims + i, slength, &state);
|
||||
if (MB_INVALIDCH (mblength))
|
||||
state = state_bak;
|
||||
else if (mblength > 1)
|
||||
{
|
||||
memcpy (d2 + ts, delims + i, mblength);
|
||||
ts += mblength;
|
||||
i += mblength;
|
||||
slength -= mblength;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (whitespace (delims[i]) == 0)
|
||||
d2[ts++] = delims[i];
|
||||
|
||||
i++;
|
||||
slength--;
|
||||
}
|
||||
d2[ts] = '\0';
|
||||
}
|
||||
@@ -1646,10 +1735,25 @@ char *
|
||||
string_list_dollar_star (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
char sep[MB_CUR_MAX + 1];
|
||||
#else
|
||||
char sep[2];
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (ifs_firstc_len == 1)
|
||||
{
|
||||
sep[0] = ifs_firstc[0];
|
||||
sep[1] = '\0';
|
||||
}
|
||||
else
|
||||
memcpy (sep, ifs_firstc, ifs_firstc_len);
|
||||
#else
|
||||
sep[0] = ifs_firstc;
|
||||
sep[1] = '\0';
|
||||
#endif
|
||||
|
||||
return (string_list_internal (list, sep));
|
||||
}
|
||||
@@ -1668,14 +1772,44 @@ string_list_dollar_at (list, quoted)
|
||||
WORD_LIST *list;
|
||||
int quoted;
|
||||
{
|
||||
char *ifs, sep[2];
|
||||
char *ifs;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
char sep[MB_CUR_MAX + 1];
|
||||
#else
|
||||
char sep[2];
|
||||
#endif
|
||||
WORD_LIST *tlist;
|
||||
|
||||
/* XXX this could just be ifs = ifs_value; */
|
||||
ifs = ifs_var ? value_cell (ifs_var) : (char *)0;
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (ifs && *ifs)
|
||||
{
|
||||
size_t mblength;
|
||||
mblength = MBLEN (ifs, strnlen (ifs, MB_CUR_MAX));
|
||||
if (MB_INVALIDCH (mblength) || mblength == 1)
|
||||
{
|
||||
sep[0] = *ifs;
|
||||
sep[1] = '\0';
|
||||
}
|
||||
else if (mblength == 0)
|
||||
sep[0] = '\0';
|
||||
else
|
||||
{
|
||||
memcpy (sep, ifs, mblength);
|
||||
sep[mblength] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sep[0] = ' ';
|
||||
sep[1] = '\0';
|
||||
}
|
||||
#else
|
||||
sep[0] = (ifs == 0 || *ifs == 0) ? ' ' : *ifs;
|
||||
sep[1] = '\0';
|
||||
#endif
|
||||
|
||||
tlist = ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (ifs && *ifs == 0))
|
||||
? quote_list (list)
|
||||
@@ -1724,6 +1858,7 @@ list_string (string, separators, quoted)
|
||||
WORD_DESC *t;
|
||||
char *current_word, *s;
|
||||
int sindex, sh_style_split, whitesep;
|
||||
size_t slen;
|
||||
|
||||
if (!string || !*string)
|
||||
return ((WORD_LIST *)NULL);
|
||||
@@ -1733,6 +1868,7 @@ list_string (string, separators, quoted)
|
||||
separators[2] == '\n' &&
|
||||
separators[3] == '\0';
|
||||
|
||||
slen = 0;
|
||||
/* Remove sequences of whitespace at the beginning of STRING, as
|
||||
long as those characters appear in IFS. Do not do this if
|
||||
STRING is quoted or if there are no separator characters. */
|
||||
@@ -1797,7 +1933,12 @@ list_string (string, separators, quoted)
|
||||
|
||||
/* Move past the current separator character. */
|
||||
if (string[sindex])
|
||||
sindex++;
|
||||
{
|
||||
DECLARE_MBSTATE;
|
||||
if (slen == 0)
|
||||
slen = strlen (string);
|
||||
ADVANCE_CHAR (string, slen, sindex);
|
||||
}
|
||||
|
||||
/* Now skip sequences of space, tab, or newline characters if they are
|
||||
in the list of separators. */
|
||||
@@ -1828,6 +1969,7 @@ get_word_from_string (stringp, separators, endptr)
|
||||
register char *s;
|
||||
char *current_word;
|
||||
int sindex, sh_style_split, whitesep;
|
||||
size_t slen;
|
||||
|
||||
if (!stringp || !*stringp || !**stringp)
|
||||
return ((char *)NULL);
|
||||
@@ -1839,6 +1981,8 @@ get_word_from_string (stringp, separators, endptr)
|
||||
separators[2] == '\n' &&
|
||||
separators[3] == '\0';
|
||||
|
||||
slen = 0;
|
||||
|
||||
/* Remove sequences of whitespace at the beginning of STRING, as
|
||||
long as those characters appear in IFS. */
|
||||
if (sh_style_split || !separators || !*separators)
|
||||
@@ -1873,7 +2017,12 @@ get_word_from_string (stringp, separators, endptr)
|
||||
|
||||
/* Move past the current separator character. */
|
||||
if (s[sindex])
|
||||
sindex++;
|
||||
{
|
||||
DECLARE_MBSTATE;
|
||||
if (slen == 0)
|
||||
slen = strlen (s);
|
||||
ADVANCE_CHAR (s, slen, sindex);
|
||||
}
|
||||
|
||||
/* Now skip sequences of space, tab, or newline characters if they are
|
||||
in the list of separators. */
|
||||
@@ -4683,6 +4832,26 @@ valid_length_expression (name)
|
||||
legal_identifier (name + 1)); /* ${#PS1} */
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
size_t
|
||||
mbstrlen (s)
|
||||
const char *s;
|
||||
{
|
||||
size_t clen, nc;
|
||||
mbstate_t mbs;
|
||||
|
||||
nc = 0;
|
||||
memset (&mbs, 0, sizeof (mbs));
|
||||
while ((clen = mbrlen(s, MB_CUR_MAX, &mbs)) != 0 && (MB_INVALIDCH(clen) == 0))
|
||||
{
|
||||
s += clen;
|
||||
nc++;
|
||||
}
|
||||
return nc;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Handle the parameter brace expansion that requires us to return the
|
||||
length of a parameter. */
|
||||
static intmax_t
|
||||
@@ -4738,14 +4907,14 @@ parameter_brace_expand_length (name)
|
||||
if (legal_number (name + 1, &arg_index)) /* ${#1} */
|
||||
{
|
||||
t = get_dollar_var_value (arg_index);
|
||||
number = STRLEN (t);
|
||||
number = MB_STRLEN (t);
|
||||
FREE (t);
|
||||
}
|
||||
#if defined (ARRAY_VARS)
|
||||
else if ((var = find_variable (name + 1)) && array_p (var))
|
||||
else if ((var = find_variable (name + 1)) && (invisible_p (var) == 0) && array_p (var))
|
||||
{
|
||||
t = array_reference (array_cell (var), 0);
|
||||
number = STRLEN (t);
|
||||
number = MB_STRLEN (t);
|
||||
}
|
||||
#endif
|
||||
else /* ${#PS1} */
|
||||
@@ -4758,7 +4927,7 @@ parameter_brace_expand_length (name)
|
||||
if (list)
|
||||
dispose_words (list);
|
||||
|
||||
number = STRLEN (t);
|
||||
number = MB_STRLEN (t);
|
||||
FREE (t);
|
||||
}
|
||||
}
|
||||
@@ -4863,7 +5032,7 @@ verify_substring_values (value, substr, vtype, e1p, e2p)
|
||||
{
|
||||
case VT_VARIABLE:
|
||||
case VT_ARRAYMEMBER:
|
||||
len = strlen (value);
|
||||
len = MB_STRLEN (value);
|
||||
break;
|
||||
case VT_POSPARMS:
|
||||
len = number_of_args () + 1;
|
||||
@@ -4871,8 +5040,9 @@ verify_substring_values (value, substr, vtype, e1p, e2p)
|
||||
#if defined (ARRAY_VARS)
|
||||
case VT_ARRAYVAR:
|
||||
a = (ARRAY *)value;
|
||||
/* For arrays, the first value deals with array indices. */
|
||||
len = array_max_index (a); /* arrays index from 0 to n - 1 */
|
||||
/* For arrays, the first value deals with array indices. Negative
|
||||
offsets count from one past the array's maximum index. */
|
||||
len = array_max_index (a) + (*e1p < 0); /* arrays index from 0 to n - 1 */
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
@@ -4883,7 +5053,7 @@ verify_substring_values (value, substr, vtype, e1p, e2p)
|
||||
if (*e1p < 0) /* negative offsets count from end */
|
||||
*e1p += len;
|
||||
|
||||
if (*e1p >= len || *e1p < 0)
|
||||
if (*e1p > len || *e1p < 0)
|
||||
return (-1);
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
@@ -4974,7 +5144,7 @@ get_var_and_type (varname, value, quoted, varp, valp)
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else if ((v = find_variable (varname)) && array_p (v))
|
||||
else if ((v = find_variable (varname)) && (invisible_p (v) == 0) && array_p (v))
|
||||
{
|
||||
vtype = VT_ARRAYMEMBER;
|
||||
*varp = v;
|
||||
@@ -6780,7 +6950,8 @@ setifs (v)
|
||||
ifs_var = v;
|
||||
ifs_value = v ? value_cell (v) : " \t\n";
|
||||
|
||||
/* Should really merge ifs_cmap with sh_syntaxtab. */
|
||||
/* Should really merge ifs_cmap with sh_syntaxtab. XXX - doesn't yet
|
||||
handle multibyte chars in IFS */
|
||||
memset (ifs_cmap, '\0', sizeof (ifs_cmap));
|
||||
for (t = ifs_value ; t && *t; t++)
|
||||
{
|
||||
@@ -6788,7 +6959,29 @@ setifs (v)
|
||||
ifs_cmap[uc] = 1;
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (ifs_value == 0)
|
||||
{
|
||||
ifs_firstc[0] = '\0';
|
||||
ifs_firstc_len = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t ifs_len;
|
||||
ifs_len = strnlen (ifs_value, MB_CUR_MAX);
|
||||
ifs_firstc_len = MBLEN (ifs_value, ifs_len);
|
||||
if (ifs_firstc_len == 1 || ifs_firstc_len == 0 || MB_INVALIDCH (ifs_firstc_len))
|
||||
{
|
||||
ifs_firstc[0] = ifs_value[0];
|
||||
ifs_firstc[1] = '\0';
|
||||
ifs_firstc_len = 1;
|
||||
}
|
||||
else
|
||||
memcpy (ifs_firstc, ifs_value, ifs_firstc_len);
|
||||
}
|
||||
#else
|
||||
ifs_firstc = ifs_value ? *ifs_value : 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
char *
|
||||
@@ -6826,12 +7019,23 @@ static WORD_LIST *
|
||||
word_list_split (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
WORD_LIST *result, *t, *tresult;
|
||||
WORD_LIST *result, *t, *tresult, *e;
|
||||
|
||||
for (t = list, result = (WORD_LIST *)NULL; t; t = t->next)
|
||||
{
|
||||
tresult = word_split (t->word, ifs_value);
|
||||
#if 0
|
||||
result = (WORD_LIST *) list_append (result, tresult);
|
||||
#else
|
||||
if (result == 0)
|
||||
result = e = tresult;
|
||||
else
|
||||
{
|
||||
e->next = tresult;
|
||||
while (e->next)
|
||||
e = e->next;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
@@ -7343,6 +7547,7 @@ expand_word_list_internal (list, eflags)
|
||||
that the variable and environment assignments affect the shell's
|
||||
environment. */
|
||||
assign_func = new_list ? assign_in_env : do_assignment;
|
||||
tempenv_assign_error = 0;
|
||||
|
||||
for (temp_list = subst_assign_varlist; temp_list; temp_list = temp_list->next)
|
||||
{
|
||||
@@ -7350,13 +7555,18 @@ expand_word_list_internal (list, eflags)
|
||||
tint = (*assign_func) (temp_list->word->word);
|
||||
/* Variable assignment errors in non-interactive shells running
|
||||
in Posix.2 mode cause the shell to exit. */
|
||||
if (tint == 0 && assign_func == do_assignment)
|
||||
if (tint == 0)
|
||||
{
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
if (interactive_shell == 0 && posixly_correct)
|
||||
exp_jump_to_top_level (FORCE_EOF);
|
||||
if (assign_func == do_assignment)
|
||||
{
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
if (interactive_shell == 0 && posixly_correct)
|
||||
exp_jump_to_top_level (FORCE_EOF);
|
||||
else
|
||||
exp_jump_to_top_level (DISCARD);
|
||||
}
|
||||
else
|
||||
exp_jump_to_top_level (DISCARD);
|
||||
tempenv_assign_error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+209
-14
@@ -124,7 +124,13 @@ pid_t current_command_subst_pid = NO_PID;
|
||||
SHELL_VAR *ifs_var;
|
||||
char *ifs_value;
|
||||
unsigned char ifs_cmap[UCHAR_MAX + 1];
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
unsigned char ifs_firstc[MB_LEN_MAX];
|
||||
size_t ifs_firstc_len;
|
||||
#else
|
||||
unsigned char ifs_firstc;
|
||||
#endif
|
||||
|
||||
/* Extern functions and variables from different files. */
|
||||
extern int last_command_exit_value, last_command_exit_signal;
|
||||
@@ -785,7 +791,7 @@ skip_double_quoted (string, slen, sind)
|
||||
{
|
||||
si = i + 2;
|
||||
if (string[i + 1] == LPAREN)
|
||||
ret = extract_delimited_string (string, &si, "$(", "(", ")", EX_NOALLOC);
|
||||
ret = extract_delimited_string (string, &si, "$(", "(", ")", EX_NOALLOC); /* ) */
|
||||
else
|
||||
ret = extract_dollar_brace_string (string, &si, 0, EX_NOALLOC);
|
||||
|
||||
@@ -862,8 +868,14 @@ string_extract_verbatim (string, sindex, charlist)
|
||||
char *charlist;
|
||||
{
|
||||
register int i = *sindex;
|
||||
size_t slen;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
size_t clen;
|
||||
wchar_t *wcharlist;
|
||||
#endif
|
||||
int c;
|
||||
char *temp;
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
if (charlist[0] == '\'' && charlist[1] == '\0')
|
||||
{
|
||||
@@ -872,18 +884,62 @@ string_extract_verbatim (string, sindex, charlist)
|
||||
return temp;
|
||||
}
|
||||
|
||||
for (i = *sindex; c = string[i]; i++)
|
||||
slen = strlen (string + *sindex) + *sindex;
|
||||
i = *sindex;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
clen = strlen (charlist);
|
||||
wcharlist = 0;
|
||||
#endif
|
||||
while (c = string[i])
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
size_t mblength;
|
||||
#endif
|
||||
if (c == CTLESC)
|
||||
{
|
||||
i++;
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
mblength = MBLEN (string + i, slen - 1);
|
||||
if (mblength > 1)
|
||||
{
|
||||
wchar_t wc;
|
||||
mblength = mbtowc (&wc, string + i, slen - i);
|
||||
if (MB_INVALIDCH (mblength))
|
||||
{
|
||||
if (MEMBER (c, charlist))
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wcharlist == 0)
|
||||
{
|
||||
size_t len;
|
||||
len = mbstowcs (wcharlist, charlist, 0);
|
||||
if (len == -1)
|
||||
len = 0;
|
||||
wcharlist = xmalloc ((sizeof (wchar_t) * len) + 1);
|
||||
mbstowcs (wcharlist, charlist, len);
|
||||
}
|
||||
|
||||
if (wcschr (wcharlist, wc))
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (MEMBER (c, charlist))
|
||||
break;
|
||||
|
||||
ADVANCE_CHAR (string, slen, i);
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
FREE (wcharlist);
|
||||
#endif
|
||||
|
||||
temp = substring (string, *sindex, i);
|
||||
*sindex = i;
|
||||
|
||||
@@ -892,13 +948,13 @@ string_extract_verbatim (string, sindex, charlist)
|
||||
|
||||
/* Extract the $( construct in STRING, and return a new string.
|
||||
Start extracting at (SINDEX) as if we had just seen "$(".
|
||||
Make (SINDEX) get the position of the matching ")". */
|
||||
Make (SINDEX) get the position of the matching ")". ) */
|
||||
char *
|
||||
extract_command_subst (string, sindex)
|
||||
char *string;
|
||||
int *sindex;
|
||||
{
|
||||
return (extract_delimited_string (string, sindex, "$(", "(", ")", 0));
|
||||
return (extract_delimited_string (string, sindex, "$(", "(", ")", 0)); /*)*/
|
||||
}
|
||||
|
||||
/* Extract the $[ construct in STRING, and return a new string. (])
|
||||
@@ -1456,11 +1512,36 @@ split_at_delims (string, slen, delims, sentinel, nwp, cwp)
|
||||
d2 = 0;
|
||||
if (delims)
|
||||
{
|
||||
d2 = (char *)xmalloc (strlen (delims) + 1);
|
||||
for (i = ts = 0; delims[i]; i++)
|
||||
size_t slength;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
size_t mblength = 1;
|
||||
#endif
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
slength = strlen (delims);
|
||||
d2 = (char *)xmalloc (slength + 1);
|
||||
i = ts = 0;
|
||||
while (delims[i])
|
||||
{
|
||||
if (whitespace(delims[i]) == 0)
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
mbstate_t state_bak = state;
|
||||
mblength = MBRLEN (delims + i, slength, &state);
|
||||
if (MB_INVALIDCH (mblength))
|
||||
state = state_bak;
|
||||
else if (mblength > 1)
|
||||
{
|
||||
memcpy (d2 + ts, delims + i, mblength);
|
||||
ts += mblength;
|
||||
i += mblength;
|
||||
slength -= mblength;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (whitespace (delims[i]) == 0)
|
||||
d2[ts++] = delims[i];
|
||||
|
||||
i++;
|
||||
slength--;
|
||||
}
|
||||
d2[ts] = '\0';
|
||||
}
|
||||
@@ -1654,10 +1735,25 @@ char *
|
||||
string_list_dollar_star (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
char sep[MB_CUR_MAX + 1];
|
||||
#else
|
||||
char sep[2];
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (ifs_firstc_len == 1)
|
||||
{
|
||||
sep[0] = ifs_firstc[0];
|
||||
sep[1] = '\0';
|
||||
}
|
||||
else
|
||||
memcpy (sep, ifs_firstc, ifs_firstc_len);
|
||||
#else
|
||||
sep[0] = ifs_firstc;
|
||||
sep[1] = '\0';
|
||||
#endif
|
||||
|
||||
return (string_list_internal (list, sep));
|
||||
}
|
||||
@@ -1676,14 +1772,44 @@ string_list_dollar_at (list, quoted)
|
||||
WORD_LIST *list;
|
||||
int quoted;
|
||||
{
|
||||
char *ifs, sep[2];
|
||||
char *ifs;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
char sep[MB_CUR_MAX + 1];
|
||||
#else
|
||||
char sep[2];
|
||||
#endif
|
||||
WORD_LIST *tlist;
|
||||
|
||||
/* XXX this could just be ifs = ifs_value; */
|
||||
ifs = ifs_var ? value_cell (ifs_var) : (char *)0;
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (ifs && *ifs)
|
||||
{
|
||||
size_t mblength;
|
||||
mblength = MBLEN (ifs, strnlen (ifs, MB_CUR_MAX));
|
||||
if (MB_INVALIDCH (mblength) || mblength == 1)
|
||||
{
|
||||
sep[0] = *ifs;
|
||||
sep[1] = '\0';
|
||||
}
|
||||
else if (mblength == 0)
|
||||
sep[0] = '\0';
|
||||
else
|
||||
{
|
||||
memcpy (sep, ifs, mblength);
|
||||
sep[mblength] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sep[0] = ' ';
|
||||
sep[1] = '\0';
|
||||
}
|
||||
#else
|
||||
sep[0] = (ifs == 0 || *ifs == 0) ? ' ' : *ifs;
|
||||
sep[1] = '\0';
|
||||
#endif
|
||||
|
||||
tlist = ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (ifs && *ifs == 0))
|
||||
? quote_list (list)
|
||||
@@ -1732,6 +1858,7 @@ list_string (string, separators, quoted)
|
||||
WORD_DESC *t;
|
||||
char *current_word, *s;
|
||||
int sindex, sh_style_split, whitesep;
|
||||
size_t slen;
|
||||
|
||||
if (!string || !*string)
|
||||
return ((WORD_LIST *)NULL);
|
||||
@@ -1741,6 +1868,7 @@ list_string (string, separators, quoted)
|
||||
separators[2] == '\n' &&
|
||||
separators[3] == '\0';
|
||||
|
||||
slen = 0;
|
||||
/* Remove sequences of whitespace at the beginning of STRING, as
|
||||
long as those characters appear in IFS. Do not do this if
|
||||
STRING is quoted or if there are no separator characters. */
|
||||
@@ -1805,7 +1933,12 @@ list_string (string, separators, quoted)
|
||||
|
||||
/* Move past the current separator character. */
|
||||
if (string[sindex])
|
||||
sindex++;
|
||||
{
|
||||
DECLARE_MBSTATE;
|
||||
if (slen == 0)
|
||||
slen = strlen (string);
|
||||
ADVANCE_CHAR (string, slen, sindex);
|
||||
}
|
||||
|
||||
/* Now skip sequences of space, tab, or newline characters if they are
|
||||
in the list of separators. */
|
||||
@@ -1836,6 +1969,7 @@ get_word_from_string (stringp, separators, endptr)
|
||||
register char *s;
|
||||
char *current_word;
|
||||
int sindex, sh_style_split, whitesep;
|
||||
size_t slen;
|
||||
|
||||
if (!stringp || !*stringp || !**stringp)
|
||||
return ((char *)NULL);
|
||||
@@ -1847,6 +1981,8 @@ get_word_from_string (stringp, separators, endptr)
|
||||
separators[2] == '\n' &&
|
||||
separators[3] == '\0';
|
||||
|
||||
slen = 0;
|
||||
|
||||
/* Remove sequences of whitespace at the beginning of STRING, as
|
||||
long as those characters appear in IFS. */
|
||||
if (sh_style_split || !separators || !*separators)
|
||||
@@ -1881,7 +2017,12 @@ get_word_from_string (stringp, separators, endptr)
|
||||
|
||||
/* Move past the current separator character. */
|
||||
if (s[sindex])
|
||||
sindex++;
|
||||
{
|
||||
DECLARE_MBSTATE;
|
||||
if (slen == 0)
|
||||
slen = strlen (s);
|
||||
ADVANCE_CHAR (s, slen, sindex);
|
||||
}
|
||||
|
||||
/* Now skip sequences of space, tab, or newline characters if they are
|
||||
in the list of separators. */
|
||||
@@ -2024,10 +2165,10 @@ do_assignment_internal (string, expand)
|
||||
if (expand && temp[0])
|
||||
{
|
||||
temp = (xstrchr (temp, '~') && unquoted_member ('~', temp))
|
||||
? bash_tilde_expand (temp, 1)
|
||||
? bash_tilde_expand (temp, 2)
|
||||
: savestring (temp);
|
||||
|
||||
value = expand_string_if_necessary (temp, 0, expand_string_unsplit);
|
||||
value = expand_string_if_necessary (temp, 0, expand_string_assignment);
|
||||
free (temp);
|
||||
}
|
||||
else
|
||||
@@ -2460,6 +2601,36 @@ expand_string_unsplit (string, quoted)
|
||||
return (value);
|
||||
}
|
||||
|
||||
/* Expand the rhs of an assignment statement */
|
||||
WORD_LIST *
|
||||
expand_string_assignment (string, quoted)
|
||||
char *string;
|
||||
int quoted;
|
||||
{
|
||||
WORD_DESC td;
|
||||
WORD_LIST *value;
|
||||
|
||||
if (string == 0 || *string == '\0')
|
||||
return ((WORD_LIST *)NULL);
|
||||
|
||||
expand_no_split_dollar_star = 1;
|
||||
|
||||
td.flags = W_ASSIGNRHS;
|
||||
td.word = savestring (string);
|
||||
value = call_expand_word_internal (&td, quoted, 0, (int *)NULL, (int *)NULL);
|
||||
FREE (td.word);
|
||||
|
||||
expand_no_split_dollar_star = 0;
|
||||
|
||||
if (value)
|
||||
{
|
||||
if (value->word)
|
||||
remove_quoted_nulls (value->word->word);
|
||||
dequote_list (value);
|
||||
}
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
||||
/* Expand one of the PS? prompt strings. This is a sort of combination of
|
||||
expand_string_unsplit and expand_string_internal, but returns the
|
||||
@@ -6180,6 +6351,7 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin
|
||||
string (e.g., "xx"ab), or is fully quoted (e.g., "xxab"). */
|
||||
int quoted_state;
|
||||
|
||||
/* State flags */
|
||||
int had_quoted_null;
|
||||
int has_dollar_at;
|
||||
int tflag;
|
||||
@@ -6809,7 +6981,8 @@ setifs (v)
|
||||
ifs_var = v;
|
||||
ifs_value = v ? value_cell (v) : " \t\n";
|
||||
|
||||
/* Should really merge ifs_cmap with sh_syntaxtab. */
|
||||
/* Should really merge ifs_cmap with sh_syntaxtab. XXX - doesn't yet
|
||||
handle multibyte chars in IFS */
|
||||
memset (ifs_cmap, '\0', sizeof (ifs_cmap));
|
||||
for (t = ifs_value ; t && *t; t++)
|
||||
{
|
||||
@@ -6817,7 +6990,29 @@ setifs (v)
|
||||
ifs_cmap[uc] = 1;
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (ifs_value == 0)
|
||||
{
|
||||
ifs_firstc[0] = '\0';
|
||||
ifs_firstc_len = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t ifs_len;
|
||||
ifs_len = strnlen (ifs_value, MB_CUR_MAX);
|
||||
ifs_firstc_len = MBLEN (ifs_value, ifs_len);
|
||||
if (ifs_firstc_len == 1 || ifs_firstc_len == 0 || MB_INVALIDCH (ifs_firstc_len))
|
||||
{
|
||||
ifs_firstc[0] = ifs_value[0];
|
||||
ifs_firstc[1] = '\0';
|
||||
ifs_firstc_len = 1;
|
||||
}
|
||||
else
|
||||
memcpy (ifs_firstc, ifs_value, ifs_firstc_len);
|
||||
}
|
||||
#else
|
||||
ifs_firstc = ifs_value ? *ifs_value : 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
char *
|
||||
|
||||
+7700
File diff suppressed because it is too large
Load Diff
@@ -1528,7 +1528,7 @@ split_at_delims (string, slen, delims, sentinel, nwp, cwp)
|
||||
mblength = MBRLEN (delims + i, slength, &state);
|
||||
if (MB_INVALIDCH (mblength))
|
||||
state = state_bak;
|
||||
else if (mblength != 1)
|
||||
else if (mblength > 1)
|
||||
{
|
||||
memcpy (d2 + ts, delims + i, mblength);
|
||||
ts += mblength;
|
||||
@@ -1793,6 +1793,8 @@ string_list_dollar_at (list, quoted)
|
||||
sep[0] = *ifs;
|
||||
sep[1] = '\0';
|
||||
}
|
||||
else if (mblength == 0)
|
||||
sep[0] = '\0';
|
||||
else
|
||||
{
|
||||
memcpy (sep, ifs, mblength);
|
||||
@@ -2161,14 +2163,7 @@ do_assignment_internal (string, expand)
|
||||
|
||||
/* Perform tilde expansion. */
|
||||
if (expand && temp[0])
|
||||
{
|
||||
temp = (xstrchr (temp, '~') && unquoted_member ('~', temp))
|
||||
? bash_tilde_expand (temp, 1)
|
||||
: savestring (temp);
|
||||
|
||||
value = expand_string_if_necessary (temp, 0, expand_string_unsplit);
|
||||
free (temp);
|
||||
}
|
||||
value = expand_string_if_necessary (temp, 0, expand_string_assignment);
|
||||
else
|
||||
value = savestring (temp);
|
||||
}
|
||||
@@ -2336,9 +2331,6 @@ 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));
|
||||
@@ -2347,7 +2339,6 @@ pos_params (string, start, end, quoted)
|
||||
else
|
||||
ret = string_list (h);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
ret = string_list ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? quote_list (h) : h);
|
||||
if (t != params)
|
||||
@@ -2364,9 +2355,9 @@ pos_params (string, start, end, quoted)
|
||||
/******************************************************************/
|
||||
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
#define EXP_CHAR(s) (s == '$' || s == '`' || s == '<' || s == '>' || s == CTLESC)
|
||||
#define EXP_CHAR(s) (s == '$' || s == '`' || s == '<' || s == '>' || s == CTLESC || s == '~')
|
||||
#else
|
||||
#define EXP_CHAR(s) (s == '$' || s == '`' || s == CTLESC)
|
||||
#define EXP_CHAR(s) (s == '$' || s == '`' || s == CTLESC || s == '~')
|
||||
#endif
|
||||
|
||||
/* If there are any characters in STRING that require full expansion,
|
||||
@@ -2493,13 +2484,6 @@ cond_expand_word (w, special)
|
||||
if (w->word == 0 || w->word[0] == '\0')
|
||||
return ((char *)NULL);
|
||||
|
||||
if (xstrchr (w->word, '~') && unquoted_member ('~', w->word))
|
||||
{
|
||||
p = bash_tilde_expand (w->word, 0);
|
||||
free (w->word);
|
||||
w->word = p;
|
||||
}
|
||||
|
||||
l = call_expand_word_internal (w, 0, 0, (int *)0, (int *)0);
|
||||
if (l)
|
||||
{
|
||||
@@ -2599,6 +2583,36 @@ expand_string_unsplit (string, quoted)
|
||||
return (value);
|
||||
}
|
||||
|
||||
/* Expand the rhs of an assignment statement */
|
||||
WORD_LIST *
|
||||
expand_string_assignment (string, quoted)
|
||||
char *string;
|
||||
int quoted;
|
||||
{
|
||||
WORD_DESC td;
|
||||
WORD_LIST *value;
|
||||
|
||||
if (string == 0 || *string == '\0')
|
||||
return ((WORD_LIST *)NULL);
|
||||
|
||||
expand_no_split_dollar_star = 1;
|
||||
|
||||
td.flags = W_ASSIGNRHS;
|
||||
td.word = savestring (string);
|
||||
value = call_expand_word_internal (&td, quoted, 0, (int *)NULL, (int *)NULL);
|
||||
FREE (td.word);
|
||||
|
||||
expand_no_split_dollar_star = 0;
|
||||
|
||||
if (value)
|
||||
{
|
||||
if (value->word)
|
||||
remove_quoted_nulls (value->word->word);
|
||||
dequote_list (value);
|
||||
}
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
||||
/* Expand one of the PS? prompt strings. This is a sort of combination of
|
||||
expand_string_unsplit and expand_string_internal, but returns the
|
||||
@@ -3555,8 +3569,6 @@ getpattern (value, quoted, expandpat)
|
||||
WORD_LIST *l;
|
||||
int i;
|
||||
|
||||
tword = xstrchr (value, '~') ? bash_tilde_expand (value, 0) : savestring (value);
|
||||
|
||||
/* There is a problem here: how to handle single or double quotes in the
|
||||
pattern string when the whole expression is between double quotes?
|
||||
POSIX.2 says that enclosing double quotes do not cause the pattern to
|
||||
@@ -3574,11 +3586,10 @@ getpattern (value, quoted, expandpat)
|
||||
|
||||
/* expand_string_for_rhs () leaves WORD quoted and does not perform
|
||||
word splitting. */
|
||||
l = *tword ? expand_string_for_rhs (tword,
|
||||
l = *value ? expand_string_for_rhs (value,
|
||||
(quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? Q_PATQUOTE : quoted,
|
||||
(int *)NULL, (int *)NULL)
|
||||
: (WORD_LIST *)0;
|
||||
free (tword);
|
||||
pat = string_list (l);
|
||||
dispose_words (l);
|
||||
if (pat)
|
||||
@@ -3626,11 +3637,7 @@ 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);
|
||||
|
||||
@@ -4707,24 +4714,16 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
|
||||
char *t, *t1, *temp;
|
||||
int hasdol;
|
||||
|
||||
/* XXX - Should we tilde expand in an assignment context if C is `='? */
|
||||
if (*value == '~')
|
||||
temp = bash_tilde_expand (value, 0);
|
||||
else if (xstrchr (value, '~') && unquoted_substring ("=~", value))
|
||||
temp = bash_tilde_expand (value, 1);
|
||||
else
|
||||
temp = savestring (value);
|
||||
|
||||
/* If the entire expression is between double quotes, we want to treat
|
||||
the value as a double-quoted string, with the exception that we strip
|
||||
embedded unescaped double quotes. */
|
||||
if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *temp)
|
||||
if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *value)
|
||||
{
|
||||
hasdol = 0;
|
||||
t = string_extract_double_quoted (temp, &hasdol, 1);
|
||||
free (temp);
|
||||
temp = t;
|
||||
temp = string_extract_double_quoted (value, &hasdol, 1);
|
||||
}
|
||||
else
|
||||
temp = value;
|
||||
|
||||
hasdol = 0;
|
||||
/* XXX was 0 not quoted */
|
||||
@@ -4732,7 +4731,8 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
|
||||
: (WORD_LIST *)0;
|
||||
if (hasdollarat)
|
||||
*hasdollarat = hasdol || (l && l->next);
|
||||
free (temp);
|
||||
if (temp != value)
|
||||
free (temp);
|
||||
if (l)
|
||||
{
|
||||
/* The expansion of TEMP returned something. We need to treat things
|
||||
@@ -4792,15 +4792,7 @@ parameter_brace_expand_error (name, value)
|
||||
|
||||
if (value && *value)
|
||||
{
|
||||
if (*value == '~')
|
||||
temp = bash_tilde_expand (value, 0);
|
||||
else if (xstrchr (value, '~') && unquoted_substring ("=~", value))
|
||||
temp = bash_tilde_expand (value, 1);
|
||||
else
|
||||
temp = savestring (value);
|
||||
|
||||
l = expand_string (temp, 0);
|
||||
FREE (temp);
|
||||
l = expand_string (value, 0);
|
||||
temp = string_list (l);
|
||||
report_error ("%s: %s", name, temp ? temp : ""); /* XXX was value not "" */
|
||||
FREE (temp);
|
||||
@@ -5454,16 +5446,9 @@ parameter_brace_patsub (varname, value, patsub, quoted)
|
||||
if (rep && *rep == '\0')
|
||||
rep = (char *)NULL;
|
||||
|
||||
#if 0
|
||||
/* Expand PAT and REP for command, variable and parameter, arithmetic,
|
||||
and process substitution. Also perform quote removal. Do not
|
||||
perform word splitting or filename generation. */
|
||||
pat = expand_string_if_necessary (lpatsub, (quoted & ~Q_DOUBLE_QUOTES), expand_string_unsplit);
|
||||
#else
|
||||
/* Perform the same expansions on the pattern as performed by the
|
||||
pattern removal expansions. */
|
||||
pat = getpattern (lpatsub, quoted, 1);
|
||||
#endif
|
||||
|
||||
if (rep)
|
||||
{
|
||||
@@ -6029,11 +6014,7 @@ 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;
|
||||
@@ -6319,10 +6300,13 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin
|
||||
string (e.g., "xx"ab), or is fully quoted (e.g., "xxab"). */
|
||||
int quoted_state;
|
||||
|
||||
/* State flags */
|
||||
int had_quoted_null;
|
||||
int has_dollar_at;
|
||||
int tflag;
|
||||
|
||||
int assignoff; /* If assignment, offset of `=' */
|
||||
|
||||
register unsigned char c; /* Current character. */
|
||||
int t_index; /* For calls to string_extract_xxx. */
|
||||
|
||||
@@ -6343,6 +6327,8 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin
|
||||
if (contains_dollar_at)
|
||||
*contains_dollar_at = 0;
|
||||
|
||||
assignoff = -1;
|
||||
|
||||
/* Begin the expansion. */
|
||||
|
||||
for (sindex = 0; ;)
|
||||
@@ -6412,6 +6398,81 @@ add_string:
|
||||
}
|
||||
#endif /* PROCESS_SUBSTITUTION */
|
||||
|
||||
case '=':
|
||||
/* Posix.2 section 3.6.1 says that tildes following `=' in words
|
||||
which are not assignment statements are not expanded. If the
|
||||
shell isn't in posix mode, though, we perform tilde expansion
|
||||
on `likely candidate' unquoted assignment statements (flags
|
||||
include W_ASSIGNMENT but not W_QUOTED). A likely candidate
|
||||
contains an unquoted :~ or =~. Something to think about: we
|
||||
now have a flag that says to perform tilde expansion on arguments
|
||||
to `assignment builtins' like declare and export that look like
|
||||
assignment statements. We now do tilde expansion on such words
|
||||
even in POSIX mode. */
|
||||
if (word->flags & (W_ASSIGNRHS|W_NOTILDE))
|
||||
goto add_character;
|
||||
/* If we're not in posix mode or forcing assignment-statement tilde
|
||||
expansion, note where the `=' appears in the word and prepare to
|
||||
do tilde expansion following the first `='. */
|
||||
if ((word->flags & W_ASSIGNMENT) &&
|
||||
(posixly_correct == 0 || (word->flags & W_TILDEEXP)) &&
|
||||
assignoff == -1 && sindex > 0)
|
||||
assignoff = sindex;
|
||||
if (sindex == assignoff && string[sindex+1] == '~') /* XXX */
|
||||
word->flags |= W_ITILDE;
|
||||
else if ((word->flags & W_ASSIGNMENT) &&
|
||||
(posixly_correct == 0 || (word->flags & W_TILDEEXP)) &&
|
||||
string[sindex+1] == '~')
|
||||
word->flags |= W_ITILDE;
|
||||
goto add_character;
|
||||
|
||||
case ':':
|
||||
if (word->flags & W_NOTILDE)
|
||||
goto add_character;
|
||||
if ((word->flags & (W_ASSIGNMENT|W_ASSIGNRHS)) &&
|
||||
(posixly_correct == 0 || (word->flags & W_TILDEEXP)) &&
|
||||
string[sindex+1] == '~')
|
||||
word->flags |= W_ITILDE;
|
||||
goto add_character;
|
||||
|
||||
case '~':
|
||||
/* If the word isn't supposed to be tilde expanded, or we're not
|
||||
at the start of a word or after an unquoted : or = in an
|
||||
assignment statement, we don't do tilde expansion. */
|
||||
if ((word->flags & W_NOTILDE) ||
|
||||
(sindex > 0 && ((word->flags & W_ITILDE) == 0)) ||
|
||||
(quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
|
||||
{
|
||||
word->flags &= ~W_ITILDE;
|
||||
goto add_character;
|
||||
}
|
||||
|
||||
if (word->flags & W_ASSIGNRHS)
|
||||
tflag = 2;
|
||||
else if ((word->flags & W_ASSIGNMENT) &&
|
||||
(posixly_correct == 0 || (word->flags & W_TILDEEXP)))
|
||||
tflag = 1;
|
||||
else
|
||||
tflag = 0;
|
||||
|
||||
temp = bash_tilde_find_word (string + sindex, tflag, &t_index);
|
||||
|
||||
word->flags &= ~W_ITILDE;
|
||||
|
||||
if (temp && *temp && t_index > 0)
|
||||
{
|
||||
temp1 = bash_tilde_expand (temp, tflag);
|
||||
free (temp);
|
||||
temp = temp1;
|
||||
sindex += t_index;
|
||||
goto add_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
FREE (temp);
|
||||
goto add_character;
|
||||
}
|
||||
|
||||
case '$':
|
||||
if (expanded_something)
|
||||
*expanded_something = 1;
|
||||
@@ -6498,11 +6559,7 @@ add_twochars:
|
||||
break;
|
||||
|
||||
case '"':
|
||||
#if 0
|
||||
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT|Q_PATQUOTE))
|
||||
#else
|
||||
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
|
||||
#endif
|
||||
goto add_character;
|
||||
|
||||
t_index = ++sindex;
|
||||
@@ -6644,11 +6701,7 @@ add_twochars:
|
||||
/* break; */
|
||||
|
||||
case '\'':
|
||||
#if 0
|
||||
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT|Q_PATQUOTE))
|
||||
#else
|
||||
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
|
||||
#endif
|
||||
goto add_character;
|
||||
|
||||
t_index = ++sindex;
|
||||
@@ -6968,10 +7021,11 @@ setifs (v)
|
||||
size_t ifs_len;
|
||||
ifs_len = strnlen (ifs_value, MB_CUR_MAX);
|
||||
ifs_firstc_len = MBLEN (ifs_value, ifs_len);
|
||||
if (ifs_firstc_len == 1 || MB_INVALIDCH (ifs_firstc_len))
|
||||
if (ifs_firstc_len == 1 || ifs_firstc_len == 0 || MB_INVALIDCH (ifs_firstc_len))
|
||||
{
|
||||
ifs_firstc[0] = ifs_value[0];
|
||||
ifs_firstc[1] = '\0';
|
||||
ifs_firstc_len = 1;
|
||||
}
|
||||
else
|
||||
memcpy (ifs_firstc, ifs_value, ifs_firstc_len);
|
||||
@@ -7381,29 +7435,6 @@ shell_expand_word_list (tlist, eflags)
|
||||
|
||||
next = tlist->next;
|
||||
|
||||
/* Posix.2 section 3.6.1 says that tildes following `=' in words
|
||||
which are not assignment statements are not expanded. If the
|
||||
shell isn't in posix mode, though, we perform tilde expansion
|
||||
on `likely candidate' unquoted assignment statements (flags
|
||||
include W_ASSIGNMENT but not W_QUOTED). A likely candidate
|
||||
contains an unquoted :~ or =~. Something to think about: we
|
||||
now have a flag that says to perform tilde expansion on arguments
|
||||
to `assignment builtins' like declare and export that look like
|
||||
assignment statements. We now do tilde expansion on such words
|
||||
even in POSIX mode. */
|
||||
if (((tlist->word->flags & (W_ASSIGNMENT|W_QUOTED)) == W_ASSIGNMENT) &&
|
||||
(posixly_correct == 0 || (tlist->word->flags & W_TILDEEXP)) &&
|
||||
(unquoted_substring ("=~", temp_string) || unquoted_substring (":~", temp_string)))
|
||||
{
|
||||
tlist->word->word = bash_tilde_expand (temp_string, 1);
|
||||
free (temp_string);
|
||||
}
|
||||
else if (temp_string[0] == '~')
|
||||
{
|
||||
tlist->word->word = bash_tilde_expand (temp_string, 0);
|
||||
free (temp_string);
|
||||
}
|
||||
|
||||
expanded_something = 0;
|
||||
expanded = expand_word_internal
|
||||
(tlist->word, 0, 0, &has_dollar_at, &expanded_something);
|
||||
|
||||
@@ -126,6 +126,9 @@ extern int number_of_args __P((void));
|
||||
takes care of quote removal. */
|
||||
extern WORD_LIST *expand_string_unsplit __P((char *, int));
|
||||
|
||||
/* Expand the rhs of an assignment statement. */
|
||||
extern WORD_LIST *expand_string_assignment __P((char *, int));
|
||||
|
||||
/* Expand a prompt string. */
|
||||
extern WORD_LIST *expand_prompt_string __P((char *, int));
|
||||
|
||||
|
||||
@@ -231,7 +231,13 @@ extern WORD_LIST *split_at_delims __P((char *, int, char *, int, int *, int *));
|
||||
extern SHELL_VAR *ifs_var;
|
||||
extern char *ifs_value;
|
||||
extern unsigned char ifs_cmap[];
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
extern unsigned char ifs_firstc[];
|
||||
extern size_t ifs_firstc_len;
|
||||
#else
|
||||
extern unsigned char ifs_firstc;
|
||||
#endif
|
||||
|
||||
/* Evaluates to 1 if C is a character in $IFS. */
|
||||
#define isifs(c) (ifs_cmap[(unsigned char)(c)] != 0)
|
||||
|
||||
+1
-1
@@ -95,6 +95,6 @@ trap: usage: trap [-lp] [arg signal_spec ...]
|
||||
./errors.tests: line 246: kill: -s: option requires an argument
|
||||
./errors.tests: line 248: kill: S: invalid signal specification
|
||||
./errors.tests: line 250: kill: `': not a pid or valid job spec
|
||||
kill: usage: kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
|
||||
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
|
||||
./errors.tests: line 255: set: trackall: invalid option name
|
||||
./errors.tests: line 262: `!!': not a valid identifier
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ command: usage: command [-pVv] command [arg ...]
|
||||
./errors.tests: line 213: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
|
||||
./errors.tests: line 216: trap: NOSIG: invalid signal specification
|
||||
./errors.tests: line 219: trap: -s: invalid option
|
||||
trap: usage: trap [-lp] [[arg] signal_spec ...]
|
||||
trap: usage: trap [-lp] [arg signal_spec ...]
|
||||
./errors.tests: line 225: return: can only `return' from a function or sourced script
|
||||
./errors.tests: line 229: break: 0: loop count out of range
|
||||
./errors.tests: line 233: continue: 0: loop count out of range
|
||||
|
||||
@@ -28,7 +28,7 @@ argv[3] = <d>
|
||||
argv[4] = <e>
|
||||
argv[5] = <f>
|
||||
argv[1] = </usr/homes/chet>
|
||||
argv[1] = </usr/homes/chet>
|
||||
argv[1] = <~>
|
||||
argv[1] = <~>
|
||||
argv[1] = <\~>
|
||||
argv[1] = <\ \~>
|
||||
@@ -108,7 +108,7 @@ argv[3] = <c>
|
||||
argv[4] = <d>
|
||||
argv[5] = <e>
|
||||
argv[6] = <f>
|
||||
./more-exp.tests: line 269: abc=def: command not found
|
||||
./more-exp.tests: line 272: abc=def: command not found
|
||||
argv[1] = <a b c d e>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
@@ -184,13 +184,13 @@ argv[1] = <1>
|
||||
argv[1] = <5>
|
||||
argv[1] = <5>
|
||||
argv[1] = <0>
|
||||
./more-exp.tests: line 420: ${#:}: bad substitution
|
||||
./more-exp.tests: line 422: ${#/}: bad substitution
|
||||
./more-exp.tests: line 424: ${#%}: bad substitution
|
||||
./more-exp.tests: line 426: ${#=}: bad substitution
|
||||
./more-exp.tests: line 428: ${#+}: bad substitution
|
||||
./more-exp.tests: line 430: ${#1xyz}: bad substitution
|
||||
./more-exp.tests: line 433: #: %: syntax error: operand expected (error token is "%")
|
||||
./more-exp.tests: line 423: ${#:}: bad substitution
|
||||
./more-exp.tests: line 425: ${#/}: bad substitution
|
||||
./more-exp.tests: line 427: ${#%}: bad substitution
|
||||
./more-exp.tests: line 429: ${#=}: bad substitution
|
||||
./more-exp.tests: line 431: ${#+}: bad substitution
|
||||
./more-exp.tests: line 433: ${#1xyz}: bad substitution
|
||||
./more-exp.tests: line 436: #: %: syntax error: operand expected (error token is "%")
|
||||
argv[1] = <0>
|
||||
argv[1] = <a+b>
|
||||
argv[1] = <+>
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
argv[1] = <aaa bbb ccc>
|
||||
argv[1] = <aaa bbb ccc>
|
||||
argv[1] = <baz:bar>
|
||||
argv[1] = <baz:bar>
|
||||
argv[1] = <aaa bbb ccc>
|
||||
argv[1] = <bar>
|
||||
argv[1] = <bar>
|
||||
argv[1] = <bar>
|
||||
argv[1] = <abcde>
|
||||
argv[1] = <abcde>
|
||||
argv[1] = <xyz>
|
||||
argv[1] = <a b>
|
||||
argv[2] = <c>
|
||||
argv[3] = <d>
|
||||
argv[4] = <e>
|
||||
argv[5] = <f>
|
||||
argv[1] = <a b>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[1] = <a b>
|
||||
argv[2] = <c>
|
||||
argv[3] = <d>
|
||||
argv[4] = <e>
|
||||
argv[5] = <f>
|
||||
argv[1] = <a b>
|
||||
argv[2] = <c>
|
||||
argv[3] = <d>
|
||||
argv[4] = <e>
|
||||
argv[5] = <f>
|
||||
argv[1] = </usr/homes/chet>
|
||||
argv[1] = <~>
|
||||
argv[1] = <~>
|
||||
argv[1] = <\~>
|
||||
argv[1] = <\ \~>
|
||||
argv[1] = <\ \ \~>
|
||||
argv[1] = </usr/homes/chet>
|
||||
argv[1] = </usr/homes/chet>
|
||||
argv[1] = </usr/homes/chet>
|
||||
argv[1] = <$HOME>
|
||||
argv[1] = <\ $HOME>
|
||||
argv[1] = <\ \ $HOME>
|
||||
argv[1] = <'bar'>
|
||||
argv[1] = <'bar'>
|
||||
argv[1] = <*@>
|
||||
argv[1] = <*@>
|
||||
argv[1] = <*@>
|
||||
argv[1] = <*@>
|
||||
argv[1] = <*@*>
|
||||
argv[1] = <*@*>
|
||||
argv[1] = <*@*>
|
||||
argv[1] = <*@*>
|
||||
argv[1] = <abcd>
|
||||
argv[1] = <efghijkl>
|
||||
argv[1] = <4>
|
||||
argv[2] = <2>
|
||||
argv[1] = <1>
|
||||
argv[1] = <bar>
|
||||
argv[1] = <2>
|
||||
argv[1] = <bar>
|
||||
argv[1] = <2>
|
||||
argv[1] = <4>
|
||||
argv[1] = <--\>
|
||||
argv[2] = <-->
|
||||
argv[1] = <--\^J-->
|
||||
argv[1] = <--+\>
|
||||
argv[2] = <+-->
|
||||
argv[1] = <--+\^J+-->
|
||||
argv[1] = <-+\>
|
||||
argv[2] = <+-\>
|
||||
argv[3] = <->
|
||||
argv[1] = <xy>
|
||||
argv[1] = <xy>
|
||||
argv[1] = <xy>
|
||||
argv[1] = <xy>
|
||||
argv[1] = <xy>
|
||||
argv[1] = <xy>
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
argv[1] = <xy>
|
||||
argv[1] = <xy>
|
||||
argv[1] = <xy>
|
||||
argv[1] = <xy>
|
||||
argv[1] = <xy>
|
||||
argv[1] = <xy>
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
argv[1] = <x>
|
||||
argv[1] = <x>
|
||||
argv[1] = <>
|
||||
argv[1] = <x>
|
||||
argv[1] = <x>
|
||||
argv[1] = <x>
|
||||
argv[1] = <x>
|
||||
argv[1] = <^?>
|
||||
argv[1] = <^?>
|
||||
argv[1] = <x>
|
||||
argv[1] = <x>
|
||||
argv[1] = <>
|
||||
argv[2] = <abd>
|
||||
argv[3] = <x>
|
||||
argv[1] = <>
|
||||
argv[2] = <abd>
|
||||
argv[3] = <>
|
||||
argv[1] = <a,b,c,d,e,f>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[3] = <c>
|
||||
argv[4] = <d>
|
||||
argv[5] = <e>
|
||||
argv[6] = <f>
|
||||
./more-exp.tests: line 272: abc=def: command not found
|
||||
argv[1] = <a b c d e>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[3] = <c>
|
||||
argv[4] = <d>
|
||||
argv[5] = <e>
|
||||
argv[1] = <foo)>
|
||||
argv[1] = <a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\\a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\\a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <$a>
|
||||
argv[1] = <\foo>
|
||||
argv[1] = <$a>
|
||||
argv[1] = <\foo>
|
||||
argv[1] = <\$a>
|
||||
argv[1] = <\\$a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <\a>
|
||||
argv[1] = <G>
|
||||
argv[2] = <{>
|
||||
argv[3] = <I>
|
||||
argv[4] = <K>
|
||||
argv[5] = <}>
|
||||
argv[1] = <hi>
|
||||
argv[2] = <K>
|
||||
argv[3] = <}>
|
||||
argv[1] = <a*>
|
||||
Number of args: 0
|
||||
<${*-x}>: <x>
|
||||
<${@-x}>: <x>
|
||||
Number of args: 1
|
||||
<${*-x}>: <>
|
||||
<${@-x}>: <>
|
||||
Number of args: 2
|
||||
<${*-x}>: < >
|
||||
<${@-x}>: < >
|
||||
argv[1] = <5>
|
||||
argv[1] = <5>
|
||||
argv[1] = <5>
|
||||
argv[1] = <5>
|
||||
argv[1] = <5>
|
||||
argv[1] = <0>
|
||||
argv[1] = <0>
|
||||
argv[1] = <0>
|
||||
argv[1] = <0>
|
||||
argv[1] = <0>
|
||||
argv[1] = <0>
|
||||
argv[1] = <posparams>
|
||||
argv[1] = <posparams>
|
||||
argv[1] = <2>
|
||||
argv[1] = <0>
|
||||
argv[1] = <0>
|
||||
argv[1] = <1>
|
||||
argv[1] = <5>
|
||||
argv[1] = <5>
|
||||
argv[1] = <0>
|
||||
./more-exp.tests: line 420: ${#:}: bad substitution
|
||||
./more-exp.tests: line 422: ${#/}: bad substitution
|
||||
./more-exp.tests: line 424: ${#%}: bad substitution
|
||||
./more-exp.tests: line 426: ${#=}: bad substitution
|
||||
./more-exp.tests: line 428: ${#+}: bad substitution
|
||||
./more-exp.tests: line 430: ${#1xyz}: bad substitution
|
||||
./more-exp.tests: line 433: #: %: syntax error: operand expected (error token is "%")
|
||||
argv[1] = <0>
|
||||
argv[1] = <a+b>
|
||||
argv[1] = <+>
|
||||
argv[1] = <+>
|
||||
argv[1] = <+>
|
||||
argv[1] = <G { I >
|
||||
argv[2] = <K>
|
||||
argv[3] = <}>
|
||||
argv[1] = <hi>
|
||||
argv[2] = <K>
|
||||
argv[3] = <}>
|
||||
argv[1] = <xxx>
|
||||
argv[2] = <yyy>
|
||||
1
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
argv[1] = <:a:>
|
||||
argv[1] = <:b:>
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
@@ -65,7 +65,10 @@ HOME=/usr/homes/chet
|
||||
somevar=
|
||||
expect "<$HOME>"
|
||||
recho ${somevar:-~}
|
||||
expect "<$HOME>"
|
||||
# This changed after bash-3.0, when the tilde implementation was redone. It's
|
||||
# not backward compatible, but it's very hard to be backward-compatible here,
|
||||
# and I think the old behavior was a bug
|
||||
expect '<~>'
|
||||
recho "${somevar:-~}"
|
||||
expect '<~>'
|
||||
recho "${somevar:-"~"}"
|
||||
|
||||
@@ -0,0 +1,501 @@
|
||||
expect()
|
||||
{
|
||||
echo expect "$@"
|
||||
}
|
||||
|
||||
tool_var() {
|
||||
eval $1=\"\${$1:-$2}\"
|
||||
export $1
|
||||
}
|
||||
|
||||
A="aaa bbb ccc"
|
||||
|
||||
unset B
|
||||
|
||||
tool_var B ${B:-"$A"}
|
||||
|
||||
expect '<aaa bbb ccc>'
|
||||
recho "$A"
|
||||
expect '<aaa bbb ccc>'
|
||||
recho "$B"
|
||||
|
||||
eto_prepend() {
|
||||
eval $1=\'$2\''${'$1':+":"${'$1'}}'; export $1
|
||||
}
|
||||
|
||||
foo=bar; export foo
|
||||
eto_prepend foo baz
|
||||
expect '<baz:bar>'
|
||||
recho $foo
|
||||
expect '<baz:bar>'
|
||||
recho ${foo-"bar"}
|
||||
|
||||
aa='aaa bbb ccc'
|
||||
|
||||
expect '<aaa bbb ccc>'
|
||||
recho ${zzz-"$aa"}
|
||||
expect '<bar>'
|
||||
recho ${zzz:-"bar"}
|
||||
expect '<bar>'
|
||||
recho "${zzz:-bar}"
|
||||
expect '<bar>'
|
||||
recho "${zzz:-"bar"}"
|
||||
|
||||
var=abcde
|
||||
expect '<abcde>'
|
||||
recho "${var:-xyz}"
|
||||
expect '<abcde>'
|
||||
recho "${var:=xyz}"
|
||||
expect '<xyz>'
|
||||
recho "${var:+xyz}"
|
||||
|
||||
set 'a b' c d e f
|
||||
expect '<a b> <c> <d> <e> <f>'
|
||||
recho ${1+"$@"}
|
||||
expect '<a b>'
|
||||
recho "${1-"$@"}"
|
||||
expect '<a> <b>'
|
||||
recho ${1-"$@"}
|
||||
expect '<a b> <c> <d> <e> <f>'
|
||||
recho "${1+$@}"
|
||||
expect '<a b> <c> <d> <e> <f>'
|
||||
recho "${1+"$@"}"
|
||||
|
||||
HOME=/usr/homes/chet
|
||||
somevar=
|
||||
expect "<$HOME>"
|
||||
recho ${somevar:-~}
|
||||
expect "<$HOME>"
|
||||
recho "${somevar:-~}"
|
||||
expect '<~>'
|
||||
recho "${somevar:-"~"}"
|
||||
expect '<\~>'
|
||||
recho "${somevar:-\~}"
|
||||
expect '<\ \~>'
|
||||
recho "${somevar:-\ \~}"
|
||||
expect '<\ \ \~>'
|
||||
recho "${somevar:-\ \ \~}"
|
||||
|
||||
expect "<$HOME>"
|
||||
recho ${somevar:-$HOME}
|
||||
expect "<$HOME>"
|
||||
recho "${somevar:-$HOME}"
|
||||
expect "<$HOME>"
|
||||
recho "${somevar:-"$HOME"}"
|
||||
expect '<$HOME>'
|
||||
recho "${somevar:-\$HOME}"
|
||||
expect '<\ $HOME>'
|
||||
recho "${somevar:-\ \$HOME}"
|
||||
expect '<\ \ $HOME>'
|
||||
recho "${somevar:-\ \ \$HOME}"
|
||||
|
||||
foo=bar
|
||||
expect "<'bar'>"
|
||||
recho "${foo+'$foo'}"
|
||||
expect "<'bar'>"
|
||||
recho "${fox='$foo'}"
|
||||
|
||||
P='*@*'
|
||||
expect '<*@>'
|
||||
recho "${P%"*"}"
|
||||
expect '<*@>'
|
||||
recho "${P%'*'}"
|
||||
|
||||
expect '<*@>'
|
||||
recho ${P%"*"}
|
||||
expect '<*@>'
|
||||
recho ${P%'*'}
|
||||
|
||||
expect '<*@*>'
|
||||
recho ${P%""}
|
||||
expect '<*@*>'
|
||||
recho ${P#""}
|
||||
|
||||
expect '<*@*>'
|
||||
recho ${P#"$foobar"}
|
||||
expect '<*@*>'
|
||||
recho ${P%"$foobar"}
|
||||
|
||||
s1=abcdefghijkl
|
||||
s2=efgh
|
||||
|
||||
first=${s1/$s2*/}
|
||||
expect '<abcd>'
|
||||
recho $first
|
||||
|
||||
last=${s1##$first}
|
||||
expect '<efghijkl>'
|
||||
recho $last
|
||||
|
||||
shift $#
|
||||
UNAME_RELEASE=${1:-4.2MP}
|
||||
|
||||
RELEASE=`expr "$UNAME_RELEASE" : '[^0-9]*\([0-9]*\)'` # 4
|
||||
case "$RELEASE" in
|
||||
"") RELEASE=0 ;;
|
||||
*) RELEASE=`expr "$RELEASE" + 0` ;;
|
||||
esac
|
||||
REL_LEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.\([0-9]*\)'` # 1
|
||||
REL_SUBLEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.[0-9]*.\([0-9]*\)'` # 2
|
||||
|
||||
expect '<4> <2>'
|
||||
recho $RELEASE $REL_LEVEL $REL_SUBLEVEL
|
||||
|
||||
b1()
|
||||
{
|
||||
b2 ${1+"$@"}
|
||||
}
|
||||
|
||||
b2()
|
||||
{
|
||||
recho $*
|
||||
recho $#
|
||||
}
|
||||
|
||||
expect '<1>'
|
||||
b1 ''
|
||||
|
||||
expect '<bar> <2>'
|
||||
b1 bar ''
|
||||
|
||||
expect '<bar> <2>'
|
||||
b1 '' bar
|
||||
|
||||
expect '<4>'
|
||||
b1 '' '' '' ''
|
||||
|
||||
NL="\\
|
||||
"
|
||||
|
||||
NNL="+$NL+"
|
||||
|
||||
expect '<--\> <-->'
|
||||
recho --$NL--
|
||||
expect '<--\^J-->'
|
||||
recho "--$NL--"
|
||||
|
||||
expect '<--+\> <+-->'
|
||||
recho --$NNL--
|
||||
expect '<--+\^J+-->'
|
||||
recho "--$NNL--"
|
||||
|
||||
expect '<-+\> <+-\> <->'
|
||||
recho -$NNL-$NL-
|
||||
|
||||
set ''
|
||||
expect '<xy>'
|
||||
recho "$*xy"
|
||||
expect '<xy>'
|
||||
recho "x$*y"
|
||||
expect '<xy>'
|
||||
recho "xy$*"
|
||||
expect '<xy>'
|
||||
recho x"$*"y
|
||||
expect '<xy>'
|
||||
recho xy"$*"
|
||||
expect '<xy>'
|
||||
recho "$*"xy
|
||||
expect '<>'
|
||||
recho "$*"
|
||||
expect nothing
|
||||
recho $*
|
||||
|
||||
unset undef ; set ""
|
||||
|
||||
expect '<>'
|
||||
recho ${undef-"$*"}
|
||||
expect '<xy>'
|
||||
recho ${undef-"x$*y"}
|
||||
expect '<xy>'
|
||||
recho ${undef-"$*xy"}
|
||||
expect '<xy>'
|
||||
recho ${undef-"xy$*"}
|
||||
expect '<xy>'
|
||||
recho ${undef-x"$*"y}
|
||||
expect '<xy>'
|
||||
recho ${undef-xy"$*"}
|
||||
expect '<xy>'
|
||||
recho ${undef-"$*"xy}
|
||||
expect '<>'
|
||||
recho "${undef-$*}"
|
||||
expect nothing
|
||||
recho ${undef-$*}
|
||||
|
||||
expect '<>'
|
||||
recho ${undef-"$zzz"}
|
||||
expect '<x>'
|
||||
recho x${undef-"$zzz"}
|
||||
expect '<x>'
|
||||
recho x${undef-"$@"}
|
||||
expect nothing
|
||||
recho ${undef-"$@"}
|
||||
expect '<x>'
|
||||
recho ${undef-"$zzz"}x
|
||||
expect '<x>'
|
||||
recho ${undef-"$@"}x
|
||||
expect '<x>'
|
||||
recho "$@"x
|
||||
expect '<x>'
|
||||
recho "$zzz"x
|
||||
expect '<^?>'
|
||||
recho ${undef-}
|
||||
expect '<^?>'
|
||||
recho ${undef-""}
|
||||
|
||||
yyy=""
|
||||
recho "$xxx"x
|
||||
recho "$yyy"x
|
||||
|
||||
set "" "abd" ""
|
||||
recho "$@"x
|
||||
recho "$@"$xxx
|
||||
|
||||
OIFS="$IFS"
|
||||
|
||||
arg=a,b,c,d,e,f
|
||||
|
||||
IFS=,
|
||||
|
||||
export z=$arg
|
||||
|
||||
eval z1=\"$arg\"
|
||||
|
||||
IFS="$OIFS"
|
||||
|
||||
recho $z
|
||||
recho $z1
|
||||
|
||||
# should give an error
|
||||
abc\=def
|
||||
|
||||
zz="a b c d e"
|
||||
declare a=$zz
|
||||
|
||||
recho "$a"
|
||||
recho $a
|
||||
|
||||
recho $(echo "foo$(echo ")")")
|
||||
|
||||
# test backslash escapes
|
||||
|
||||
recho \a
|
||||
recho \\a
|
||||
|
||||
recho "\a"
|
||||
recho "\\a"
|
||||
|
||||
recho '\a'
|
||||
recho '\\a'
|
||||
|
||||
recho $(zecho \a)
|
||||
recho $(zecho \\a)
|
||||
|
||||
recho $(zecho "\a")
|
||||
recho $(zecho "\\a")
|
||||
|
||||
recho $(zecho '\a')
|
||||
recho $(zecho '\\a')
|
||||
|
||||
recho `zecho \a`
|
||||
recho `zecho \\a`
|
||||
|
||||
recho `zecho "\a"`
|
||||
recho `zecho "\\a"`
|
||||
|
||||
recho `zecho '\a'`
|
||||
recho `zecho '\\a'`
|
||||
|
||||
a=foo
|
||||
|
||||
recho \$a
|
||||
recho \\$a
|
||||
|
||||
recho "\$a"
|
||||
recho "\\$a"
|
||||
|
||||
recho '\$a'
|
||||
recho '\\$a'
|
||||
|
||||
recho $(zecho `zecho \a`)
|
||||
recho $(zecho `zecho \\a`)
|
||||
|
||||
recho $(zecho `zecho "\a"`)
|
||||
recho $(zecho `zecho "\\a"`)
|
||||
|
||||
recho $(zecho `zecho '\a'`)
|
||||
recho $(zecho `zecho '\\a'`)
|
||||
|
||||
# should echo G { I K }
|
||||
recho ${abc:-G { I } K }
|
||||
|
||||
abc=hi
|
||||
|
||||
# should echo hi K }
|
||||
recho ${abc:-G { I } K }
|
||||
|
||||
# should echo a*
|
||||
unset foo
|
||||
recho "${foo:-"a"}*"
|
||||
|
||||
f ()
|
||||
{
|
||||
echo "Number of args: $#"
|
||||
echo "<\${*-x}>: <${*-x}>"
|
||||
echo "<\${@-x}>: <${@-x}>"
|
||||
}
|
||||
|
||||
f
|
||||
f ''
|
||||
f '' ''
|
||||
|
||||
set 1 2 3 4 5
|
||||
|
||||
expect '<5>'
|
||||
recho ${#}
|
||||
expect '<5>'
|
||||
recho ${#:foo}
|
||||
expect '<5>'
|
||||
recho ${#:-foo}
|
||||
expect '<5>'
|
||||
recho ${#-posparams}
|
||||
expect '<5>'
|
||||
recho ${#:-posparams}
|
||||
|
||||
expect '<0>'
|
||||
recho ${#!}
|
||||
|
||||
expect nothing
|
||||
recho $!
|
||||
expect nothing
|
||||
recho ${!}
|
||||
|
||||
expect nothing
|
||||
recho $8
|
||||
expect nothing
|
||||
recho ${8}
|
||||
|
||||
shift $#
|
||||
|
||||
expect '<0>'
|
||||
recho ${#}
|
||||
expect '<0>'
|
||||
recho ${#:foo}
|
||||
expect '<0>'
|
||||
recho ${#:-foo}
|
||||
expect '<0>'
|
||||
recho ${#-posparams}
|
||||
expect '<0>'
|
||||
recho ${#:-posparams}
|
||||
|
||||
expect '<posparams>'
|
||||
recho ${!-posparams}
|
||||
expect '<posparams>'
|
||||
recho ${!:-posparams}
|
||||
|
||||
expect '<2>'
|
||||
recho ${#-}
|
||||
|
||||
expect '<0>'
|
||||
recho ${#-posparams}
|
||||
|
||||
expect '<0>'
|
||||
recho ${#?:-xyz}
|
||||
|
||||
expect '<1>'
|
||||
recho ${#?}
|
||||
|
||||
set a b c d e
|
||||
|
||||
expect '<5>'
|
||||
recho ${#}
|
||||
expect '<5>'
|
||||
recho ${#?:-xyz}
|
||||
|
||||
shift $#
|
||||
|
||||
expect '<0>'
|
||||
recho ${#:-foo}
|
||||
|
||||
expect a bad substitution error
|
||||
recho ${#:}
|
||||
expect a bad substitution error
|
||||
recho ${#/}
|
||||
expect a bad substitution error
|
||||
recho ${#%}
|
||||
expect a bad substitution error
|
||||
recho ${#=}
|
||||
expect a bad substitution error
|
||||
recho ${#+}
|
||||
expect a bad substitution error
|
||||
recho ${#1xyz}
|
||||
|
||||
expect a math syntax error
|
||||
recho ${#:%}
|
||||
|
||||
expect '<0>'
|
||||
recho ${#:-}
|
||||
|
||||
set --
|
||||
unset a b
|
||||
|
||||
x=a
|
||||
y=b
|
||||
|
||||
IFS=+
|
||||
|
||||
expect '<a+b>'
|
||||
recho $x+$y
|
||||
expect '<+>'
|
||||
recho $a+$b
|
||||
|
||||
expect '<+>'
|
||||
recho + "$@"
|
||||
expect '<+>'
|
||||
recho +"$@"
|
||||
|
||||
# variants of nested curly braces inside ${...} expressions
|
||||
|
||||
# IFS is not the standard one
|
||||
|
||||
expect '<G { I>' '<K>' '<}>'
|
||||
recho ${gik:-G { I } K }
|
||||
|
||||
abc=hi
|
||||
|
||||
expect '<hi>' '<K>' '<}>'
|
||||
recho ${abc:-G { I } K }
|
||||
|
||||
# reset IFS to the default
|
||||
IFS='
|
||||
'
|
||||
|
||||
# nested ${...} inside ${...} are handled specially
|
||||
unset XXX FOO BAR
|
||||
expect '<xxx>' '<yyy>'
|
||||
XXX=xxx
|
||||
FOO=${BAR:-${XXX} yyy}
|
||||
recho $FOO
|
||||
|
||||
# this was a bug in versions of bash prior to bash-2.04-release
|
||||
set -- ''
|
||||
expect 1
|
||||
echo $#
|
||||
expect '<>'
|
||||
recho "${@}"
|
||||
expect '<>'
|
||||
recho "${@-}"
|
||||
expect '<>'
|
||||
recho "${@:-}"
|
||||
|
||||
# this was a bug in bash-2.04, fixed in 2.05
|
||||
set -- a b
|
||||
expect '<:a:>' '<:b:>'
|
||||
for i in "${@-}"; do recho :$i:; done
|
||||
|
||||
# I believe that ksh93 does these wrong -- we're using the rhs, so shouldn't
|
||||
# it behave the same as ""?
|
||||
set --
|
||||
expect '<>'
|
||||
recho "${@-}"
|
||||
expect '<>'
|
||||
recho "${@:-}"
|
||||
Reference in New Issue
Block a user