commit bash-20060119 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 22:44:15 -05:00
parent 11a6f9a95f
commit b317c077a1
21 changed files with 6186 additions and 65 deletions
+3 -1
View File
@@ -253,4 +253,6 @@ bash-2.0 were significant.)
29. In versions of bash after 3.1, the ${parameter//pattern/replacement}
expansion does not interpret `%' or `#' specially. Those anchors don't
have any real meaning when replacing every match.
30. Beginning with bash-3.1, the combination of posix mode and enabling the
`xpg_echo' option causes echo to ignore all options, not looking for `-n'
+32
View File
@@ -12846,3 +12846,35 @@ subst.c
- in parameter_brace_expand, if extracting ${#varname}, only allow
`}' to end the expansion, since none of the other expansions are
valid. Fixes Debian bug reported by Jan Nordhorlz <jckn@gmx.net>
1/17
----
parse.y
- in parse_matched_pair, protect all character tests with the MBTEST
macro
- in parse_dparen, take out extra make_word after call to alloc_word_desc
(mem leak)
1/18
----
parse.y
- in parse_matched_pair, add P_ALLOWESC to flags passed to recursive
parse_matched_pair call when encountering a single or double quote
inside a ``-style command substitution
execute_cmd.c
- add call to QUIT at beginning of execute_command_internal; better
responsiveness to SIGINT
1/21
----
lib/readline/bind.c
- change rl_invoking_keyseqs_in_map to honor the setting of
convert-meta when listing key bindings, since if convert-meta is off,
using '\M-' as the prefix for bindings in, for instance,
emacs-escape-keymap, is wrong. This affects `bind -p' output
- change rl_untranslate_keyseq to add '\e' instead of '\C-[' for
ESC
execute_cmd.c
- add call to QUIT at end of execute_command
+30 -1
View File
@@ -12845,4 +12845,33 @@ jobs.c
subst.c
- in parameter_brace_expand, if extracting ${#varname}, only allow
`}' to end the expansion, since none of the other expansions are
valid
valid. Fixes Debian bug reported by Jan Nordhorlz <jckn@gmx.net>
1/17
----
parse.y
- in parse_matched_pair, protect all character tests with the MBTEST
macro
- in parse_dparen, take out extra make_word after call to alloc_word_desc
(mem leak)
1/18
----
parse.y
- in parse_matched_pair, add P_ALLOWESC to flags passed to recursive
parse_matched_pair call when encountering a single or double quote
inside a ``-style command substitution
execute_cmd.c
- add call to QUIT at beginning of execute_command_internal; better
responsiveness to SIGINT
1/21
----
lib/readline/bind.c
- change rl_invoking_keyseqs_in_map to honor the setting of
convert-meta when listing key bindings, since if convert-meta is off,
using '\M-' as the prefix for bindings in, for instance,
emacs-escape-keymap, is wrong. This affects `bind -p' output
- change rl_untranslate_keyseq to add '\e' instead of '\C-[' for
ESC
+2
View File
@@ -527,6 +527,8 @@ support/texi2html f 755
support/xenix-link.sh f 755
support/shobj-conf f 755
support/rlvers.sh f 755
examples/INDEX.txt f
examples/INDEX.html f
examples/bashdb/PERMISSION f
examples/bashdb/README f
examples/bashdb/bashdb f
+2
View File
@@ -466,6 +466,8 @@ po/en@quot.po f
po/en@boldquot.po f
po/en@quot.gmo f
po/en@boldquot.gmo f
po/ru.po f
po/ru.gmo f
po/insert-header.sin f
po/quot.sed f
po/remove-potcdate.sin f
+822
View File
@@ -0,0 +1,822 @@
<table border=1>
<tr>
<th>Path</th>
<th>Description</th>
<th>X-Ref</th>
</tr>
<tr>
<td>./bashdb</td>
<td>Deprecated sample implementation of a bash debugger</td>
</tr>
<tr>
</tr>
<tr>
<td>./complete</td>
<td>Shell completion code</td>
</tr>
<tr>
</tr>
<tr>
<td>./functions</td>
<td>Example functions</td>
</tr>
<tr>
<td>./functions/array-stuff</td>
<td>Various array functions (ashift, array_sort, reverse).</td>
</tr>
<tr>
<td>./functions/array-to-string</td>
<td>Convert an array to a string.</td>
</tr>
<tr>
<td>./functions/autoload</td>
<td>An almost ksh-compatible 'autoload' (no lazy load).</td>
<td>ksh</td>
</tr>
<tr>
<td>./functions/autoload.v2</td>
<td>An almost ksh-compatible 'autoload' (no lazy load).</td>
<td>ksh</td>
</tr>
<tr>
<td>./functions/autoload.v3</td>
<td>A more ksh-compatible 'autoload' (with lazy load).</td>
<td>ksh</td>
</tr>
<tr>
<td>./functions/basename</td>
<td>A replacement for basename(1).</td>
<td>basename</td>
</tr>
<tr>
<td>./functions/basename2</td>
<td>Fast basename(1) and dirname(1) functions for BASH/SH.</td>
<td>basename, dirname</td>
</tr>
<tr>
<td>./functions/coproc.bash</td>
<td>Start, control, and end coprocesses.</td>
</tr>
<tr>
<td>./functions/coshell.bash</td>
<td>Control shell coprocesses (see coprocess.bash).</td>
</tr>
<tr>
<td>./functions/coshell.README</td>
<td>README for coshell and coproc.</td>
</tr>
<tr>
<td>./functions/csh-compat</td>
<td>A C-shell compatibility package.</td>
<td>csh</td>
</tr>
<tr>
<td>./functions/dirfuncs</td>
<td>Directory manipulation functions from the book 'The Korn Shell'.</td>
</tr>
<tr>
<td>./functions/dirname</td>
<td>A replacement for dirname(1).</td>
<td>dirname</td>
</tr>
<tr>
<td>./functions/emptydir</td>
<td>Find out if a directory is empty.</td>
</tr>
<tr>
<td>./functions/exitstat</td>
<td>Display the exit status of processes.</td>
</tr>
<tr>
<td>./functions/external</td>
<td>Like 'command' but FORCES use of external command.</td>
</tr>
<tr>
<td>./functions/fact</td>
<td>Recursive factorial function.</td>
</tr>
<tr>
<td>./functions/fstty</td>
<td>Front end to sync TERM changes to both stty(1) and readline 'bind'.</td>
<td>stty.bash</td>
</tr>
<tr>
<td>./functions/func</td>
<td>Print out definitions for functions named by arguments.</td>
</tr>
<tr>
<td>./functions/gethtml</td>
<td>Get a web page from a remote server (wget(1) in bash!).</td>
</tr>
<tr>
<td>./functions/getoptx.bash</td>
<td>getopt function that parses long-named options.</td>
</tr>
<tr>
<td>./functions/inetaddr</td>
<td>Internet address conversion (inet2hex & hex2inet).</td>
</tr>
<tr>
<td>./functions/inpath</td>
<td>Return zero if the argument is in the path and executable.</td>
<td>inpath</td>
</tr>
<tr>
<td>./functions/isnum.bash</td>
<td>Test user input on numeric or character value.</td>
</tr>
<tr>
<td>./functions/isnum2</td>
<td>Test user input on numeric values, with floating point.</td>
</tr>
<tr>
<td>./functions/isvalidip</td>
<td>Test user input for valid IP Addresses.</td>
</tr>
<tr>
<td>./functions/jdate.bash</td>
<td>Julian date conversion.</td>
</tr>
<tr>
<td>./functions/jj.bash</td>
<td>Look for running jobs.</td>
</tr>
<tr>
<td>./functions/keep</td>
<td>Try to keep some programs in the forground and running.</td>
</tr>
<tr>
<td>./functions/ksh-cd</td>
<td>ksh-like 'cd': cd [-LP] [dir [change]].</td>
<td>ksh</td>
</tr>
<tr>
<td>./functions/ksh-compat-test</td>
<td>ksh-like arithmetic test replacements.</td>
<td>ksh</td>
</tr>
<tr>
<td>./functions/kshenv</td>
<td>Functions and aliases to provide the beginnings of a ksh environment for bash.</td>
<td>ksh</td>
</tr>
<tr>
<td>./functions/login</td>
<td>Replace the 'login' and 'newgrp' builtins in old Bourne shells.</td>
</tr>
<tr>
<td>./functions/lowercase</td>
<td>Rename files to lower case.</td>
<td>rename lower</td>
</tr>
<tr>
<td>./functions/manpage</td>
<td>Find and print a manual page.</td>
<td>fman</td>
</tr>
<tr>
<td>./functions/mhfold</td>
<td>Print MH folders, useful only because folders(1) doesn't print mod date/times.</td>
</tr>
<tr>
<td>./functions/notify.bash</td>
<td>Notify when jobs change status.</td>
</tr>
<tr>
<td>./functions/pathfuncs</td>
<td>Path related functions (no_path, add_path, pre-path, del_path).</td>
<td>path</td>
</tr>
<tr>
<td>./functions/README</td>
<td>README</td>
</tr>
<tr>
<td>./functions/recurse</td>
<td>Recursive directory traverser.</td>
</tr>
<tr>
<td>./functions/repeat2</td>
<td>A clone of C shell builtin 'repeat'.</td>
<td>repeat, csh</td>
</tr>
<tr>
<td>./functions/repeat3</td>
<td>A clone of C shell builtin 'repeat'.</td>
<td>repeat, csh</td>
</tr>
<tr>
<td>./functions/seq</td>
<td>Generate a sequence from m to n, m defaults to 1.</td>
</tr>
<tr>
<td>./functions/seq2</td>
<td>Generate a sequence from m to n, m defaults to 1.</td>
</tr>
<tr>
<td>./functions/shcat</td>
<td>Readline-based pager.</td>
<td>cat, readline pager</td>
</tr>
<tr>
<td>./functions/shcat2</td>
<td>Readline-based pagers.</td>
<td>cat, readline pager</td>
</tr>
<tr>
<td>./functions/sort-pos-params</td>
<td>Sort the positional parameters.</td>
</tr>
<tr>
<td>./functions/substr</td>
<td>A function to emulate the ancient ksh builtin.</td>
<td>ksh</td>
</tr>
<tr>
<td>./functions/substr2</td>
<td>A function to emulate the ancient ksh builtin.</td>
<td>ksh</td>
</tr>
<tr>
<td>./functions/term</td>
<td>A shell function to set the terminal type interactively or not.</td>
</tr>
<tr>
<td>./functions/whatis</td>
<td>An implementation of the 10th Edition Unix sh builtin 'whatis(1)' command.</td>
</tr>
<tr>
<td>./functions/whence</td>
<td>An almost-ksh compatible 'whence(1)' command.</td>
</tr>
<tr>
<td>./functions/which</td>
<td>An emulation of 'which(1)' as it appears in FreeBSD.</td>
</tr>
<tr>
<td>./functions/xalias.bash</td>
<td>Convert csh alias commands to bash functions.</td>
<td>csh, aliasconv</td>
</tr>
<tr>
<td>./functions/xfind.bash</td>
<td>A 'find(1)' clone.</td>
</tr>
<tr>
</tr>
<tr>
<td>./loadables/</td>
<td>Example loadable replacements</td>
</tr>
<tr>
<td>./loadables/basename.c</td>
<td>Return non-directory portion of pathname.</td>
<td>basename</td>
</tr>
<tr>
<td>./loadables/cat.c</td>
<td>cat(1) replacement with no options - the way cat was intended.</td>
<td>cat, readline pager</td>
</tr>
<tr>
<td>./loadables/cut.c</td>
<td>cut(1) replacement.</td>
</tr>
<tr>
<td>./loadables/dirname.c</td>
<td>Return directory portion of pathname.</td>
<td>dirname</td>
</tr>
<tr>
<td>./loadables/finfo.c</td>
<td>Print file info.</td>
</tr>
<tr>
<td>./loadables/getconf.c</td>
<td>POSIX.2 getconf utility.</td>
</tr>
<tr>
<td>./loadables/getconf.h</td>
<td>Replacement definitions for ones the system doesn't provide.</td>
</tr>
<tr>
<td>./loadables/head.c</td>
<td>Copy first part of files.</td>
</tr>
<tr>
<td>./loadables/hello.c</td>
<td>Obligatory "Hello World" / sample loadable.</td>
</tr>
<tr>
<td>./loadables/id.c</td>
<td>POSIX.2 user identity.</td>
</tr>
<tr>
<td>./loadables/ln.c</td>
<td>Make links.</td>
</tr>
<tr>
<td>./loadables/logname.c</td>
<td>Print login name of current user.</td>
</tr>
<tr>
<td>./loadables/Makefile.in</td>
<td>Simple makefile for the sample loadable builtins.</td>
</tr>
<tr>
<td>./loadables/mkdir.c</td>
<td>Make directories.</td>
</tr>
<tr>
<td>./loadables/necho.c</td>
<td>echo without options or argument interpretation.</td>
</tr>
<tr>
<td>./loadables/pathchk.c</td>
<td>Check pathnames for validity and portability.</td>
</tr>
<tr>
<td>./loadables/print.c</td>
<td>Loadable ksh-93 style print builtin.</td>
</tr>
<tr>
<td>./loadables/printenv.c</td>
<td>Minimal builtin clone of BSD printenv(1).</td>
</tr>
<tr>
<td>./loadables/push.c</td>
<td>Anyone remember TOPS-20?</td>
</tr>
<tr>
<td>./loadables/README</td>
<td>README</td>
</tr>
<tr>
<td>./loadables/realpath.c</td>
<td>Canonicalize pathnames, resolving symlinks.</td>
</tr>
<tr>
<td>./loadables/rmdir.c</td>
<td>Remove directory.</td>
</tr>
<tr>
<td>./loadables/sleep.c</td>
<td>sleep for fractions of a second.</td>
</tr>
<tr>
<td>./loadables/strftime.c</td>
<td>Loadable builtin interface to strftime(3).</td>
</tr>
<tr>
<td>./loadables/sync.c</td>
<td>Sync the disks by forcing pending filesystem writes to complete.</td>
</tr>
<tr>
<td>./loadables/tee.c</td>
<td>Duplicate standard input.</td>
</tr>
<tr>
<td>./loadables/template.c</td>
<td>Example template for loadable builtin.</td>
</tr>
<tr>
<td>./loadables/truefalse.c</td>
<td>True and false builtins.</td>
</tr>
<tr>
<td>./loadables/tty.c</td>
<td>Return terminal name.</td>
</tr>
<tr>
<td>./loadables/uname.c</td>
<td>Print system information.</td>
</tr>
<tr>
<td>./loadables/unlink.c</td>
<td>Remove a directory entry.</td>
</tr>
<tr>
<td>./loadables/whoami.c</td>
<td>Print out username of current user.</td>
</tr>
<tr>
</tr>
<tr>
<td>./loadables/perl/</td>
<td>Illustrate how to build a Perl interpreter into bash.</td>
</tr>
<tr>
</tr>
<tr>
<td>./misc</td>
<td>Miscellaneous</td>
</tr>
<tr>
<td>./misc/aliasconv.bash</td>
<td>Convert csh aliases to bash aliases and functions.</td>
<td>csh, xalias</td>
</tr>
<tr>
<td>./misc/aliasconv.sh</td>
<td>Convert csh aliases to bash aliases and functions.</td>
<td>csh, xalias</td>
</tr>
<tr>
<td>./misc/cshtobash</td>
<td>Convert csh aliases, environment variables, and variables to bash equivalents.</td>
<td>csh, xalias</td>
</tr>
<tr>
<td>./misc/README</td>
<td>README</td>
</tr>
<tr>
<td>./misc/suncmd.termcap</td>
<td>SunView TERMCAP string.</td>
</tr>
<tr>
</tr>
<tr>
<td>./obashdb</td>
<td>Modified version of the Korn Shell debugger from Bill Rosenblatt's 'Learning the Korn Shell'.</td>
</tr>
<tr>
</tr>
<tr>
<td>./scripts.noah</td>
<td>Noah Friedman's collection of scripts (updated to bash v2 syntax by Chet Ramey)</td>
</tr>
<tr>
<td>./scripts.noah/aref.bash</td>
<td>Pseudo-arrays and substring indexing examples.</td>
</tr>
<tr>
<td>./scripts.noah/bash.sub.bash</td>
<td>Library functions used by require.bash.</td>
</tr>
<tr>
<td>./scripts.noah/bash_version.bash</td>
<td>A function to slice up $BASH_VERSION.</td>
</tr>
<tr>
<td>./scripts.noah/meta.bash</td>
<td>Enable and disable eight-bit readline input.</td>
</tr>
<tr>
<td>./scripts.noah/mktmp.bash</td>
<td>Make a temporary file with a unique name.</td>
</tr>
<tr>
<td>./scripts.noah/number.bash</td>
<td>A fun hack to translate numerals into English.</td>
</tr>
<tr>
<td>./scripts.noah/PERMISSION</td>
<td>Permissions to use the scripts in this directory.</td>
</tr>
<tr>
<td>./scripts.noah/prompt.bash</td>
<td>A way to set PS1 to some predefined strings.</td>
</tr>
<tr>
<td>./scripts.noah/README</td>
<td>README</td>
</tr>
<tr>
<td>./scripts.noah/remap_keys.bash</td>
<td>A front end to 'bind' to redo readline bindings.</td>
</tr>
<tr>
<td>./scripts.noah/require.bash</td>
<td>Lisp-like require/provide library functions for bash.</td>
</tr>
<tr>
<td>./scripts.noah/send_mail.bash</td>
<td>Replacement SMTP client written in bash.</td>
</tr>
<tr>
<td>./scripts.noah/shcat.bash</td>
<td>Bash replacement for 'cat(1)'.</td>
<td>cat</td>
</tr>
<tr>
<td>./scripts.noah/source.bash</td>
<td>Replacement for source that uses current directory.</td>
</tr>
<tr>
<td>./scripts.noah/string.bash</td>
<td>The string(3) functions at the shell level.</td>
</tr>
<tr>
<td>./scripts.noah/stty.bash</td>
<td>Front-end to stty(1) that changes readline bindings too.</td>
<td>fstty</td>
</tr>
<tr>
<td>./scripts.noah/y_or_n_p.bash</td>
<td>Prompt for a yes/no/quit answer.</td>
<td>ask</td>
</tr>
<tr>
</tr>
<tr>
<td>./scripts.v2</td>
<td>John DuBois' ksh script collection (converted to bash v2 syntax by Chet Ramey).</td>
</tr>
<tr>
<td>./scripts.v2/arc2tarz</td>
<td>Convert an "arc" archive to a compressed tar archive.</td>
</tr>
<tr>
<td>./scripts.v2/bashrand</td>
<td>Random number generator with upper and lower bounds and optional seed.</td>
<td>random</td>
</tr>
<tr>
<td>./scripts.v2/cal2day.bash</td>
<td>Convert a day number to a name.</td>
</tr>
<tr>
<td>./scripts.v2/cdhist.bash</td>
<td>cd replacement with a directory stack added.</td>
</tr>
<tr>
<td>./scripts.v2/corename</td>
<td>Tell what produced a core file.</td>
</tr>
<tr>
<td>./scripts.v2/fman</td>
<td>Fast man(1) replacement.</td>
<td>manpage</td>
</tr>
<tr>
<td>./scripts.v2/frcp</td>
<td>Copy files using ftp(1) but with rcp-type command line syntax.</td>
</tr>
<tr>
<td>./scripts.v2/lowercase</td>
<td>Change filenames to lower case.</td>
<td>rename lower</td>
</tr>
<tr>
<td>./scripts.v2/ncp</td>
<td>A nicer front end for cp(1) (has -i, etc.).</td>
</tr>
<tr>
<td>./scripts.v2/newext</td>
<td>Change the extension of a group of files.</td>
<td>rename</td>
</tr>
<tr>
<td>./scripts.v2/nmv</td>
<td>A nicer front end for mv(1) (has -i, etc.).</td>
<td>rename</td>
</tr>
<tr>
<td>./scripts.v2/pages</td>
<td>Print specified pages from files.</td>
</tr>
<tr>
<td>./scripts.v2/PERMISSION</td>
<td>Permissions to use the scripts in this directory.</td>
</tr>
<tr>
<td>./scripts.v2/pf</td>
<td>A pager front end that handles compressed files.</td>
</tr>
<tr>
<td>./scripts.v2/pmtop</td>
<td>Poor man's 'top(1)' for SunOS 4.x and BSD/OS.</td>
</tr>
<tr>
<td>./scripts.v2/README</td>
<td>README</td>
</tr>
<tr>
<td>./scripts.v2/ren</td>
<td>Rename files by changing parts of filenames that match a pattern.</td>
<td>rename</td>
</tr>
<tr>
<td>./scripts.v2/rename</td>
<td>Change the names of files that match a pattern.</td>
<td>rename</td>
</tr>
<tr>
<td>./scripts.v2/repeat</td>
<td>Execute a command multiple times.</td>
<td>repeat</td>
</tr>
<tr>
<td>./scripts.v2/shprof</td>
<td>Line profiler for bash scripts.</td>
</tr>
<tr>
<td>./scripts.v2/untar</td>
<td>Unarchive a (possibly compressed) tarfile into a directory.</td>
</tr>
<tr>
<td>./scripts.v2/uudec</td>
<td>Carefully uudecode(1) multiple files.</td>
</tr>
<tr>
<td>./scripts.v2/uuenc</td>
<td>uuencode(1) multiple files.</td>
</tr>
<tr>
<td>./scripts.v2/vtree</td>
<td>Print a visual display of a directory tree.</td>
<td>tree</td>
</tr>
<tr>
<td>./scripts.v2/where</td>
<td>Show where commands that match a pattern are.</td>
</tr>
<tr>
</tr>
<tr>
<td>./scripts</td>
<td>Example scripts</td>
</tr>
<tr>
<td>./scripts/adventure.sh</td>
<td>Text adventure game in bash!</td>
</tr>
<tr>
<td>./scripts/bcsh.sh</td>
<td>Bourne shell cshell-emulator.</td>
<td>csh</td>
</tr>
<tr>
<td>./scripts/cat.sh</td>
<td>Readline-based pager.</td>
<td>cat, readline pager</td>
</tr>
<tr>
<td>./scripts/center</td>
<td>Center - center a group of lines.</td>
</tr>
<tr>
<td>./scripts/dd-ex.sh</td>
<td>Line editor using only /bin/sh, /bin/dd and /bin/rm.</td>
</tr>
<tr>
<td>./scripts/fixfiles.bash</td>
<td>Recurse a tree and fix files containing various "bad" chars.</td>
</tr>
<tr>
<td>./scripts/hanoi.bash</td>
<td>The inevitable Towers of Hanoi in bash.</td>
</tr>
<tr>
<td>./scripts/inpath</td>
<td>Search $PATH for a file the same name as $1; return TRUE if found.</td>
<td>inpath</td>
</tr>
<tr>
<td>./scripts/krand.bash</td>
<td>Produces a random number within integer limits.</td>
<td>random</td>
</tr>
<tr>
<td>./scripts/line-input.bash</td>
<td>Line input routine for GNU Bourne-Again Shell plus terminal-control primitives.</td>
</tr>
<tr>
<td>./scripts/nohup.bash</td>
<td>bash version of 'nohup' command.</td>
</tr>
<tr>
<td>./scripts/precedence</td>
<td>Test relative precedences for '&&' and '||' operators.</td>
</tr>
<tr>
<td>./scripts/randomcard.bash</td>
<td>Print a random card from a card deck.</td>
<td>random</td>
</tr>
<tr>
<td>./scripts/README</td>
<td>README</td>
</tr>
<tr>
<td>./scripts/scrollbar</td>
<td>Display scrolling text.</td>
</tr>
<tr>
<td>./scripts/scrollbar2</td>
<td>Display scrolling text.</td>
</tr>
<tr>
<td>./scripts/self-repro</td>
<td>A self-reproducing script (careful!)</td>
</tr>
<tr>
<td>./scripts/showperm.bash</td>
<td>Convert ls(1) symbolic permissions into octal mode.</td>
</tr>
<tr>
<td>./scripts/shprompt</td>
<td>Display a prompt and get an answer satisfying certain criteria.</td>
<td>ask</td>
</tr>
<tr>
<td>./scripts/spin.bash</td>
<td>Display a 'spinning wheel' to show progress.</td>
</tr>
<tr>
<td>./scripts/timeout</td>
<td>Give rsh(1) a shorter timeout.</td>
</tr>
<tr>
<td>./scripts/vtree2</td>
<td>Display a tree printout of dir in 1k blocks.</td>
<td>tree</td>
</tr>
<tr>
<td>./scripts/vtree3</td>
<td>Display a graphical tree printout of dir.</td>
<td>tree</td>
</tr>
<tr>
<td>./scripts/vtree3a</td>
<td>Display a graphical tree printout of dir.</td>
<td>tree</td>
</tr>
<tr>
<td>./scripts/websrv.sh</td>
<td>A web server in bash!</td>
</tr>
<tr>
<td>./scripts/xterm_title</td>
<td>Print the contents of the xterm title bar.</td>
</tr>
<tr>
<td>./scripts/zprintf</td>
<td>Emulate printf (obsolete since it's now a bash builtin).</td>
</tr>
<tr>
</tr>
<tr>
<td>./startup-files</td>
<td>Example Start-up files.</td>
</tr>
<tr>
<td>./startup-files/Bash_aliases</td>
<td>Some useful aliases (Fox).</td>
</tr>
<tr>
<td>./startup-files/Bash_profile</td>
<td>Sample startup file for bash login shells (Fox).</td>
</tr>
<tr>
<td>./startup-files/bash-profile</td>
<td>Sample startup file for bash login shells (Ramey).</td>
</tr>
<tr>
<td>./startup-files/bashrc</td>
<td>Sample Bourne Again SHell init file (Ramey).</td>
</tr>
<tr>
<td>./startup-files/Bashrc.bfox</td>
<td>Sample Bourne Again SHell init file (Fox).</td>
</tr>
<tr>
<td>./startup-files/README</td>
<td>README</td>
</tr>
<tr>
</tr>
<tr>
<td>./startup-files/apple</td>
<td>Example Start-up files for Mac OS X.</td>
</tr>
<tr>
<td>./startup-files/apple/aliases</td>
<td>Sample aliases for Mac OS X.</td>
</tr>
<tr>
<td>./startup-files/apple/bash.defaults</td>
<td>Sample User preferences file.</td>
</tr>
<tr>
<td>./startup-files/apple/environment</td>
<td>Sample Bourne Again Shell environment file.</td>
</tr>
<tr>
<td>./startup-files/apple/login</td>
<td>Sample login wrapper.</td>
</tr>
<tr>
<td>./startup-files/apple/logout</td>
<td>Sample logout wrapper.</td>
</tr>
<tr>
<td>./startup-files/apple/rc</td>
<td>Sample Bourne Again Shell config file.</td>
</tr>
<tr>
<td>./startup-files/apple/README</td>
<td>README</td>
</tr>
</table>
+198
View File
@@ -0,0 +1,198 @@
Path Description X-Ref
./bashdb Deprecated sample implementation of a bash debugger
./complete Shell completion code
./functions Example functions
./functions/array-stuff Various array functions (ashift, array_sort, reverse).
./functions/array-to-string Convert an array to a string.
./functions/autoload An almost ksh-compatible 'autoload' (no lazy load). ksh
./functions/autoload.v2 An almost ksh-compatible 'autoload' (no lazy load). ksh
./functions/autoload.v3 A more ksh-compatible 'autoload' (with lazy load). ksh
./functions/basename A replacement for basename(1). basename
./functions/basename2 Fast basename(1) and dirname(1) functions for BASH/SH. basename, dirname
./functions/coproc.bash Start, control, and end coprocesses.
./functions/coshell.bash Control shell coprocesses (see coprocess.bash).
./functions/coshell.README README for coshell and coproc.
./functions/csh-compat A C-shell compatibility package. csh
./functions/dirfuncs Directory manipulation functions from the book 'The Korn Shell'.
./functions/dirname A replacement for dirname(1). dirname
./functions/emptydir Find out if a directory is empty.
./functions/exitstat Display the exit status of processes.
./functions/external Like 'command' but FORCES use of external command.
./functions/fact Recursive factorial function.
./functions/fstty Front end to sync TERM changes to both stty(1) and readline 'bind'. stty.bash
./functions/func Print out definitions for functions named by arguments.
./functions/gethtml Get a web page from a remote server (wget(1) in bash!).
./functions/getoptx.bash getopt function that parses long-named options.
./functions/inetaddr Internet address conversion (inet2hex & hex2inet).
./functions/inpath Return zero if the argument is in the path and executable. inpath
./functions/isnum.bash Test user input on numeric or character value.
./functions/isnum2 Test user input on numeric values, with floating point.
./functions/isvalidip Test user input for valid IP Addresses.
./functions/jdate.bash Julian date conversion.
./functions/jj.bash Look for running jobs.
./functions/keep Try to keep some programs in the forground and running.
./functions/ksh-cd ksh-like 'cd': cd [-LP] [dir [change]]. ksh
./functions/ksh-compat-test ksh-like arithmetic test replacements. ksh
./functions/kshenv Functions and aliases to provide the beginnings of a ksh environment for bash. ksh
./functions/login Replace the 'login' and 'newgrp' builtins in old Bourne shells.
./functions/lowercase Rename files to lower case. rename lower
./functions/manpage Find and print a manual page. fman
./functions/mhfold Print MH folders, useful only because folders(1) doesn't print mod date/times.
./functions/notify.bash Notify when jobs change status.
./functions/pathfuncs Path related functions (no_path, add_path, pre-path, del_path). path
./functions/README README
./functions/recurse Recursive directory traverser.
./functions/repeat2 A clone of C shell builtin 'repeat'. repeat, csh
./functions/repeat3 A clone of C shell builtin 'repeat'. repeat, csh
./functions/seq Generate a sequence from m to n, m defaults to 1.
./functions/seq2 Generate a sequence from m to n, m defaults to 1.
./functions/shcat Readline-based pager. cat, readline pager
./functions/shcat2 Readline-based pagers. cat, readline pager
./functions/sort-pos-params Sort the positional parameters.
./functions/substr A function to emulate the ancient ksh builtin. ksh
./functions/substr2 A function to emulate the ancient ksh builtin. ksh
./functions/term A shell function to set the terminal type interactively or not.
./functions/whatis An implementation of the 10th Edition Unix sh builtin 'whatis(1)' command.
./functions/whence An almost-ksh compatible 'whence(1)' command.
./functions/which An emulation of 'which(1)' as it appears in FreeBSD.
./functions/xalias.bash Convert csh alias commands to bash functions. csh, aliasconv
./functions/xfind.bash A 'find(1)' clone.
./loadables/ Example loadable replacements
./loadables/basename.c Return non-directory portion of pathname. basename
./loadables/cat.c cat(1) replacement with no options - the way cat was intended. cat, readline pager
./loadables/cut.c cut(1) replacement.
./loadables/dirname.c Return directory portion of pathname. dirname
./loadables/finfo.c Print file info.
./loadables/getconf.c POSIX.2 getconf utility.
./loadables/getconf.h Replacement definitions for ones the system doesn't provide.
./loadables/head.c Copy first part of files.
./loadables/hello.c Obligatory "Hello World" / sample loadable.
./loadables/id.c POSIX.2 user identity.
./loadables/ln.c Make links.
./loadables/logname.c Print login name of current user.
./loadables/Makefile.in Simple makefile for the sample loadable builtins.
./loadables/mkdir.c Make directories.
./loadables/necho.c echo without options or argument interpretation.
./loadables/pathchk.c Check pathnames for validity and portability.
./loadables/print.c Loadable ksh-93 style print builtin.
./loadables/printenv.c Minimal builtin clone of BSD printenv(1).
./loadables/push.c Anyone remember TOPS-20?
./loadables/README README
./loadables/realpath.c Canonicalize pathnames, resolving symlinks.
./loadables/rmdir.c Remove directory.
./loadables/sleep.c sleep for fractions of a second.
./loadables/strftime.c Loadable builtin interface to strftime(3).
./loadables/sync.c Sync the disks by forcing pending filesystem writes to complete.
./loadables/tee.c Duplicate standard input.
./loadables/template.c Example template for loadable builtin.
./loadables/truefalse.c True and false builtins.
./loadables/tty.c Return terminal name.
./loadables/uname.c Print system information.
./loadables/unlink.c Remove a directory entry.
./loadables/whoami.c Print out username of current user.
./loadables/perl/ Illustrate how to build a Perl interpreter into bash.
./misc Miscellaneous
./misc/aliasconv.bash Convert csh aliases to bash aliases and functions. csh, xalias
./misc/aliasconv.sh Convert csh aliases to bash aliases and functions. csh, xalias
./misc/cshtobash Convert csh aliases, environment variables, and variables to bash equivalents. csh, xalias
./misc/README README
./misc/suncmd.termcap SunView TERMCAP string.
./obashdb Modified version of the Korn Shell debugger from Bill Rosenblatt's 'Learning the Korn Shell'.
./scripts.noah Noah Friedman's collection of scripts (updated to bash v2 syntax by Chet Ramey)
./scripts.noah/aref.bash Pseudo-arrays and substring indexing examples.
./scripts.noah/bash.sub.bash Library functions used by require.bash.
./scripts.noah/bash_version.bash A function to slice up $BASH_VERSION.
./scripts.noah/meta.bash Enable and disable eight-bit readline input.
./scripts.noah/mktmp.bash Make a temporary file with a unique name.
./scripts.noah/number.bash A fun hack to translate numerals into English.
./scripts.noah/PERMISSION Permissions to use the scripts in this directory.
./scripts.noah/prompt.bash A way to set PS1 to some predefined strings.
./scripts.noah/README README
./scripts.noah/remap_keys.bash A front end to 'bind' to redo readline bindings.
./scripts.noah/require.bash Lisp-like require/provide library functions for bash.
./scripts.noah/send_mail.bash Replacement SMTP client written in bash.
./scripts.noah/shcat.bash Bash replacement for 'cat(1)'. cat
./scripts.noah/source.bash Replacement for source that uses current directory.
./scripts.noah/string.bash The string(3) functions at the shell level.
./scripts.noah/stty.bash Front-end to stty(1) that changes readline bindings too. fstty
./scripts.noah/y_or_n_p.bash Prompt for a yes/no/quit answer. ask
./scripts.v2 John DuBois' ksh script collection (converted to bash v2 syntax by Chet Ramey).
./scripts.v2/arc2tarz Convert an "arc" archive to a compressed tar archive.
./scripts.v2/bashrand Random number generator with upper and lower bounds and optional seed. random
./scripts.v2/cal2day.bash Convert a day number to a name.
./scripts.v2/cdhist.bash cd replacement with a directory stack added.
./scripts.v2/corename Tell what produced a core file.
./scripts.v2/fman Fast man(1) replacement. manpage
./scripts.v2/frcp Copy files using ftp(1) but with rcp-type command line syntax.
./scripts.v2/lowercase Change filenames to lower case. rename lower
./scripts.v2/ncp A nicer front end for cp(1) (has -i, etc.).
./scripts.v2/newext Change the extension of a group of files. rename
./scripts.v2/nmv A nicer front end for mv(1) (has -i, etc.). rename
./scripts.v2/pages Print specified pages from files.
./scripts.v2/PERMISSION Permissions to use the scripts in this directory.
./scripts.v2/pf A pager front end that handles compressed files.
./scripts.v2/pmtop Poor man's 'top(1)' for SunOS 4.x and BSD/OS.
./scripts.v2/README README
./scripts.v2/ren Rename files by changing parts of filenames that match a pattern. rename
./scripts.v2/rename Change the names of files that match a pattern. rename
./scripts.v2/repeat Execute a command multiple times. repeat
./scripts.v2/shprof Line profiler for bash scripts.
./scripts.v2/untar Unarchive a (possibly compressed) tarfile into a directory.
./scripts.v2/uudec Carefully uudecode(1) multiple files.
./scripts.v2/uuenc uuencode(1) multiple files.
./scripts.v2/vtree Print a visual display of a directory tree. tree
./scripts.v2/where Show where commands that match a pattern are.
./scripts Example scripts
./scripts/adventure.sh Text adventure game in bash!
./scripts/bcsh.sh Bourne shell cshell-emulator. csh
./scripts/cat.sh Readline-based pager. cat, readline pager
./scripts/center Center - center a group of lines.
./scripts/dd-ex.sh Line editor using only /bin/sh, /bin/dd and /bin/rm.
./scripts/fixfiles.bash Recurse a tree and fix files containing various "bad" chars.
./scripts/hanoi.bash The inevitable Towers of Hanoi in bash.
./scripts/inpath Search $PATH for a file the same name as $1; return TRUE if found. inpath
./scripts/krand.bash Produces a random number within integer limits. random
./scripts/line-input.bash Line input routine for GNU Bourne-Again Shell plus terminal-control primitives.
./scripts/nohup.bash bash version of 'nohup' command.
./scripts/precedence Test relative precedences for '&&' and '||' operators.
./scripts/randomcard.bash Print a random card from a card deck. random
./scripts/README README
./scripts/scrollbar Display scrolling text.
./scripts/scrollbar2 Display scrolling text.
./scripts/self-repro A self-reproducing script (careful!)
./scripts/showperm.bash Convert ls(1) symbolic permissions into octal mode.
./scripts/shprompt Display a prompt and get an answer satisfying certain criteria. ask
./scripts/spin.bash Display a 'spinning wheel' to show progress.
./scripts/timeout Give rsh(1) a shorter timeout.
./scripts/vtree2 Display a tree printout of dir in 1k blocks. tree
./scripts/vtree3 Display a graphical tree printout of dir. tree
./scripts/vtree3a Display a graphical tree printout of dir. tree
./scripts/websrv.sh A web server in bash!
./scripts/xterm_title Print the contents of the xterm title bar.
./scripts/zprintf Emulate printf (obsolete since it's now a bash builtin).
./startup-files Example Start-up files.
./startup-files/Bash_aliases Some useful aliases (Fox).
./startup-files/Bash_profile Sample startup file for bash login shells (Fox).
./startup-files/bash-profile Sample startup file for bash login shells (Ramey).
./startup-files/bashrc Sample Bourne Again SHell init file (Ramey).
./startup-files/Bashrc.bfox Sample Bourne Again SHell init file (Fox).
./startup-files/README README
./startup-files/apple Example Start-up files for Mac OS X.
./startup-files/apple/aliases Sample aliases for Mac OS X.
./startup-files/apple/bash.defaults Sample User preferences file.
./startup-files/apple/environment Sample Bourne Again Shell environment file.
./startup-files/apple/login Sample login wrapper.
./startup-files/apple/logout Sample logout wrapper.
./startup-files/apple/rc Sample Bourne Again Shell config file.
./startup-files/apple/README README
+33
View File
@@ -31,3 +31,36 @@ Many of the details needed by builtin writers are found in hello.c,
the canonical example. There is no real `builtin writers' programming
guide'. The file template.c provides a template to use for creating
new loadable builtins.
basename.c Return non-directory portion of pathname.
cat.c cat(1) replacement with no options - the way cat was intended.
cut.c cut(1) replacement.
dirname.c Return directory portion of pathname.
finfo.c Print file info.
getconf.c POSIX.2 getconf utility.
getconf.h Replacement definitions for ones the system doesn't provide.
head.c Copy first part of files.
hello.c Obligatory "Hello World" / sample loadable.
id.c POSIX.2 user identity.
ln.c Make links.
logname.c Print login name of current user.
Makefile.in Simple makefile for the sample loadable builtins.
mkdir.c Make directories.
necho.c echo without options or argument interpretation.
pathchk.c Check pathnames for validity and portability.
print.c Loadable ksh-93 style print builtin.
printenv.c Minimal builtin clone of BSD printenv(1).
push.c Anyone remember TOPS-20?
README README
realpath.c Canonicalize pathnames, resolving symlinks.
rmdir.c Remove directory.
sleep.c sleep for fractions of a second.
strftime.c Loadable builtin interface to strftime(3).
sync.c Sync the disks by forcing pending filesystem writes to complete.
tee.c Duplicate standard input.
template.c Example template for loadable builtin.
truefalse.c True and false builtins.
tty.c Return terminal name.
uname.c Print system information.
unlink.c Remove a directory entry.
whoami.c Print out username of current user.
+17 -15
View File
@@ -7,18 +7,20 @@ any of them. They exist simply as examples of bash scripting.
Here's a description of what's in this directory:
aref.bash pseudo-arrays and substring indexing examples
bash.sub.bash library functions used by require.bash
bash_version.bash a function to slice up $BASH_VERSION
meta.bash enable and disable eight-bit readline input
mktmp.bash make a temporary file with a unique name
number.bash a fun hack to translate numerals into english
prompt.bash a way to set PS1 to some predefined strings
remap_keys.bash a front end to `bind' to redo readline bindings
require.bash lisp-like require/provide library functions for bash
send_mail.bash replacement smtp client written in bash
shcat.bash bash replacement for `cat'
source.bash replacement for source that uses current directory
string.bash the string(3) functions at the shell level
stty.bash front-end to stty that changes readline bindings too
y_or_n_p.bash prompt for a yes/no/quit answer
aref.bash Pseudo-arrays and substring indexing examples.
bash.sub.bash Library functions used by require.bash.
bash_version.bash A function to slice up $BASH_VERSION.
meta.bash Enable and disable eight-bit readline input.
mktmp.bash Make a temporary file with a unique name.
number.bash A fun hack to translate numerals into English.
PERMISSION Permissions to use the scripts in this directory.
prompt.bash A way to set PS1 to some predefined strings.
README README
remap_keys.bash A front end to 'bind' to redo readline bindings.
require.bash Lisp-like require/provide library functions for bash.
send_mail.bash Replacement SMTP client written in bash.
shcat.bash Bash replacement for 'cat(1)'.
source.bash Replacement for source that uses current directory.
string.bash The string(3) functions at the shell level.
stty.bash Front-end to stty(1) that changes readline bindings too.
y_or_n_p.bash Prompt for a yes/no/quit answer.
+25 -21
View File
@@ -7,27 +7,31 @@ any of them. They exist simply as examples of bash scripting.
Here's a description of what's in this directory:
arc2tarz Convert an "arc" archive to a compressed tar archive.
corename Tell what produced a core file.
fman Fast man replacement.
frcp Copy files using ftp but with rcp-type command line syntax.
lowercase Change filenames to lower case.
ncp A nicer front end for cp (has -i, etc.).
newext Change the extension of a group of files.
nmv A nicer front end for mv (has -i, etc.).
pages Print specified pages from files.
pf A pager front end that handles compressed files.
rename Change the names of files that match a pattern.
repeat Execute a command multiple times.
untar Unarchive a (possibly compressed) tarfile into a directory.
uudec Carefully uudecode multiple files.
uuenc uuencode multiple files.
vtree Print a visual display of a directory tree.
where Show where commands that match a pattern are.
arc2tarz Convert an "arc" archive to a compressed tar archive.
cal2day.bash Convert a day number to a name.
corename Tell what produced a core file.
fman Fast man(1) replacement.
frcp Copy files using ftp(1) but with rcp-type command line syntax.
lowercase Change filenames to lower case.
ncp A nicer front end for cp(1) (has -i, etc.).
newext Change the extension of a group of files.
nmv A nicer front end for mv(1) (has -i, etc.).
pages Print specified pages from files.
PERMISSION Permissions to use the scripts in this directory.
pf A pager front end that handles compressed files.
README README
ren Rename files by changing parts of filenames that match a pattern.
rename Change the names of files that match a pattern.
repeat Execute a command multiple times.
untar Unarchive a (possibly compressed) tarfile into a directory.
uudec Carefully uudecode(1) multiple files.
uuenc uuencode(1) multiple files.
vtree Print a visual display of a directory tree.
where Show where commands that match a pattern are.
The following scripts were written or converted by Chet Ramey:
bashrand Random number generator with upper and lower bounds and optional seed
cdhist cd replacement with a directory stack added
pmtop Poor man's `top' for SunOS 4.x and BSD/OS
shprof Line profiler for bash scripts
bashrand Random number generator with upper and lower bounds and optional seed.
cdhist.bash cd replacement with a directory stack added.
pmtop Poor man's 'top(1)' for SunOS 4.x and BSD/OS.
shprof Line profiler for bash scripts.
+16
View File
@@ -3,3 +3,19 @@ are originally from Brian Fox. The ones starting with lowercase
letters are from Chet Ramey.
They will require changes for your environment.
Bash_aliases Some useful aliases (Fox).
Bash_profile Sample startup file for bash login shells (Fox).
bash-profile Sample startup file for bash login shells (Ramey).
bashrc Sample Bourne Again SHell init file (Ramey).
Bashrc.bfox Sample Bourne Again SHell init file (Fox).
README README
apple Example Start-up files for Mac OS X.
apple/aliases Sample aliases for Mac OS X.
apple/bash.defaults Sample User preferences file.
apple/environment Sample Bourne Again Shell environment file.
apple/login Sample login wrapper.
apple/logout Sample logout wrapper.
apple/rc Sample Bourne Again Shell config file.
apple/README README
+9
View File
@@ -22,3 +22,12 @@ See the corresponding file in /usr/share/init/bash for more information about th
-Fred
tritan@mit.edu
aliases Sample aliases for Mac OS X.
bash.defaults Sample User preferences file.
environment Sample Bourne Again Shell environment file.
login Sample login wrapper.
logout Sample logout wrapper.
rc Sample Bourne Again Shell config file.
README README
+2
View File
@@ -359,6 +359,7 @@ execute_command (command)
unlink_fifo_list ();
#endif /* PROCESS_SUBSTITUTION */
QUIT;
return (result);
}
@@ -501,6 +502,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
if (command == 0 || breaking || continuing || read_but_dont_execute)
return (EXECUTION_SUCCESS);
QUIT;
run_pending_traps ();
#if 0
+1 -1
View File
@@ -501,6 +501,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
if (command == 0 || breaking || continuing || read_but_dont_execute)
return (EXECUTION_SUCCESS);
QUIT;
run_pending_traps ();
#if 0
@@ -2625,7 +2626,6 @@ execute_null_command (redirects, pipe_in, pipe_out, async)
{
int r;
itrace("execute_null_command: async = %d subshell_environment = %d", async, subshell_environment);
if (pipe_in != NO_PIPE || pipe_out != NO_PIPE || async)
{
/* We have a null command, but we really want a subshell to take
+22 -8
View File
@@ -1,6 +1,6 @@
/* bind.c -- key binding and startup file support for the readline library. */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2006 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
@@ -574,6 +574,11 @@ rl_untranslate_keyseq (seq)
kseq[i++] = '-';
c = UNMETA (c);
}
else if (c == ESC)
{
kseq[i++] = '\\';
c = 'e';
}
else if (CTRL_CHAR (c))
{
kseq[i++] = '\\';
@@ -622,7 +627,12 @@ _rl_untranslate_macro_value (seq)
*r++ = '-';
c = UNMETA (c);
}
else if (CTRL_CHAR (c) && c != ESC)
else if (c == ESC)
{
*r++ = '\\';
c = 'e';
}
else if (CTRL_CHAR (c))
{
*r++ = '\\';
*r++ = 'C';
@@ -1956,12 +1966,16 @@ rl_invoking_keyseqs_in_map (function, map)
char *keyname = (char *)xmalloc (6 + strlen (seqs[i]));
if (key == ESC)
#if 0
sprintf (keyname, "\\e");
#else
/* XXX - experimental */
sprintf (keyname, "\\M-");
#endif
{
/* If ESC is the meta prefix and we're converting chars
with the eighth bit set to ESC-prefixed sequences, then
we can use \M-. Otherwise we need to use the sequence
for ESC. */
if (_rl_convert_meta_chars_to_ascii && map[ESC].type == ISKMAP)
sprintf (keyname, "\\M-");
else
sprintf (keyname, "\\e");
}
else if (CTRL_CHAR (key))
sprintf (keyname, "\\C-%c", _rl_to_lower (UNCTRL (key)));
else if (key == RUBOUT)
+7 -7
View File
@@ -463,7 +463,7 @@ rl_translate_keyseq (seq, array, len)
else if (c == 'M')
{
i++; /* seq[i] == '-' */
/* XXX - should obey convert-meta setting? */
/* XXX - obey convert-meta setting */
if (_rl_convert_meta_chars_to_ascii && _rl_keymap[ESC].type == ISKMAP)
array[l++] = ESC; /* ESC is meta-prefix */
else if (seq[i+1] == '\\' && seq[i+2] == 'C' && seq[i+3] == '-')
@@ -1956,12 +1956,12 @@ rl_invoking_keyseqs_in_map (function, map)
char *keyname = (char *)xmalloc (6 + strlen (seqs[i]));
if (key == ESC)
#if 0
sprintf (keyname, "\\e");
#else
/* XXX - experimental */
sprintf (keyname, "\\M-");
#endif
{
if (_rl_convert_meta_chars_to_ascii && map[ESC].type == ISKMAP)
sprintf (keyname, "\\M-");
else
sprintf (keyname, "\\e");
}
else if (CTRL_CHAR (key))
sprintf (keyname, "\\C-%c", _rl_to_lower (UNCTRL (key)));
else if (key == RUBOUT)
+8 -10
View File
@@ -2742,11 +2742,8 @@ parse_matched_pair (qc, open, close, lenp, flags)
start_lineno = line_number;
while (count)
{
#if 0
ch = shell_getc ((qc != '\'' || (flags & P_ALLOWESC)) && pass_next_character == 0);
#else
ch = shell_getc (qc != '\'' && pass_next_character == 0);
#endif
if (ch == EOF)
{
free (ret);
@@ -2771,7 +2768,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
continue;
}
/* Not exactly right yet */
else if (check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind -1])))
else if MBTEST(check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind - 1])))
in_comment = 1;
if (pass_next_character) /* last char was backslash */
@@ -2798,11 +2795,9 @@ parse_matched_pair (qc, open, close, lenp, flags)
}
else if MBTEST(ch == close) /* ending delimiter */
count--;
#if 1
/* handle nested ${...} specially. */
else if MBTEST(open != close && was_dollar && open == '{' && ch == open) /* } */
count++;
#endif
else if MBTEST(((flags & P_FIRSTCLOSE) == 0) && ch == open) /* nested begin */
count++;
@@ -2898,7 +2893,11 @@ add_nestret:
}
else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 0)
{
nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags);
/* Add P_ALLOWESC so backslash quotes the next character and
shell_getc does the right thing with \<newline>. We do this for
a measure of backwards compatibility -- it's not strictly the
right POSIX thing. */
nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_ALLOWESC);
goto add_nestret;
}
else if MBTEST(was_dollar && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
@@ -2946,7 +2945,6 @@ parse_dparen (c)
{
wd = alloc_word_desc ();
wd->word = wval;
wd = make_word (wval);
yylval.word_list = make_word_list (wd, (WORD_LIST *)NULL);
return (ARITH_FOR_EXPRS);
}
@@ -3496,7 +3494,7 @@ read_token_word (character)
}
else
{
/* Try to locale)-expand the converted string. */
/* Try to locale-expand the converted string. */
ttrans = localeexpand (ttok, 0, ttoklen - 1, first_line, &ttranslen);
free (ttok);
+4927
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/bash/bash-current
BUILD_DIR=/usr/local/build/chet/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
+7
View File
@@ -40,3 +40,10 @@ foo
bar
foo\
bar
argv[1] = <foo \\^Jbar>
argv[1] = <foo \^Jbar>
argv[1] = <sed> argv[2] = <-e> argv[3] = <s/[^I:]/\^J/g>
argv[1] = <sed> argv[2] = <-e> argv[3] = <s/[^I:]//g>
argv[1] = <foo\^Jbar>
argv[1] = <foobar>
argv[1] = <foo\^Jbar>
+22
View File
@@ -61,3 +61,25 @@ echo "$(echo 'foo
bar')"
echo "$(echo 'foo\
bar')"
# old-style command substitution parsing compatibility tests -- post bash-3.1
recho 'foo \\
bar'
recho 'foo \
bar'
echo `recho sed -e 's/[ :]/\\
/g'`
echo `recho sed -e 's/[ :]/\
/g'`
echo `recho 'foo\\
bar'`
echo `recho 'foo\
bar'`
echo $(recho 'foo\
bar')