Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 7, 2016
0 parents commit b39327a
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 0 deletions.
Binary file added 2130.pdf
Binary file not shown.
Binary file added 2146.tar.gz
Binary file not shown.
Binary file added 2147.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions 2745.html
@@ -0,0 +1 @@
<h3>Errata</h3><h1>Shell Scripting Recipes</h1><h2>A Problem-Solution Approach</h2><h3>by Chris F.A. Johnson</h3><h2>Chapter 1</h2><h4>standard-vars</h4><p> <b>Page 9</b><br> For the sake of consistency with the code that supposedly created the file, the lines from "standard-vars" should read:<pre>NL="""R="TAB=" "</pre><h4>Bourne Shell Expansions</h4><p> A number of newlines are missing from this section, starting with the last line of <b>Page 12</b> which should be:<pre>$ echo /$var-y//y/</pre> <b>Page 13</b><br><pre>$ echo /${var+C}//X/ Finally, when the variable is set and not null, VALUE is used, withor without the colon.$ var=A$ echo /${var:+X}//X/$ echo /${var+X}//X/</pre> An extra comma appears on <b>Page 14</b>; it should be:<pre>> list=${list:+$list,}$f</pre><p>Thanks to Jens Schweikhardt for pointing out the errors in Chapter 1.</p><h2>Chapter 3</h2><h4>Notes: gsub()</h4><p>On <b>Page 72</b> the '_gsub' function under "Notes" should be:</p><pre>_gsub() { _GSUB=${1//"$2"/"$3"}; }</pre><h2>Chapter 5</h2><h4>3. Convert Degrees Celsius to Fahrenheit</h4><b>Page 126</b>, in the c2f (not '_c2f') function, '_C2F=' should beremoved:<pre>c2f(){ prompt="Degrees Celsius" arg "$@" echo "$arg" | awk '{ printf "%" pr "f\n", $1 * 1.8 + 32 }' pr=${precision:-.2}}</pre><p><b>Page 129</b>, in the cm2i (not '_cm2i') function, 'Millimeters'should be 'Centimeters', and the function call and variable in thelast two lines of 'mm2i' are wrong.</p><pre>cm2i(){ units=inches prompt=Centimeters arg "$@" _cm2i "$arg" printf "%s%s\n" "$_CM2I" "${units:+ $units}"}</pre><p><b>Convert Millimeters to Inches</b><pre>mm2i(){ units=inches prompt=Millimeters arg "$@" _mm2i "$arg" printf "%s%s\n" "$_MM2I" "${units:+ $units}"}</pre><h4>The Lengths and Distances Menu</h4><p><b>Page 134</b>, the last item on the menu should be:<pre> 8. mm2i - millimeters to inches</pre><p>David Emme provided the corrections to Chapter 5; thanks, David.</p><h2>Chapter 15</h2><h4>_put_csv</h4><p>On <b>Page 312</b>, the '_put_csv' function didn't deal with leadingnull fields. Gregg Nelson provided a fix:<pre>_put_csv(){ _PUT_CSV= for field in "$@" ## loop through the fields (on command line) do case $field in ## If field contains non-numerics, enclose in quotes *[!0-9.-]*) _PUT_CSV=$_PUT_CSV\"$field\", ;; '') _PUT_CSV=$_PUT_CSV, ;; *) _PUT_CSV=$_PUT_CSV$field, ;; esac done _PUT_CSV=${_PUT_CSV%,} ## remove trailing comma}</pre><h2>Chapter 20</h2><p>In the install_script() function on <b>Page 402</b>, the variable'$file' should be '$1', and the path should be removed:<pre> filename=${1%$devel_suffix} ## Command name, without suffix filename=${filename##*/} ## Remove path; use file name alone</pre><p>Also in the install_script() function, on <b>Page 403</b>, removingwrite permissions from the script can cause problems in someinstances. If they do, just remove them or comment them out:<pre># ## Remove write permissions# chmod +rx,-w "$dest"</pre><h4>_uniqfile()</h4><p>A function was missing from the cpsh script on <b>Page 403</b>.This should be inserted before "progname=${0##*/}".<pre>_uniqfile(){ _base=$1 _n=1 while [ -f "$_UNIQFILE" ] || [ -d "$_UNIQFILE" ] do _zpad $_n ${VERSION_WIDTH} _UNIQFILE=$_base-$_ZPAD _n=$(( $_n + 1 )) done}</pre>
Expand Down
Binary file added 9781590594711.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,27 @@
Freeware License, some rights reserved

Copyright (c) 2005 Chris Johnson

Permission is hereby granted, free of charge, to anyone obtaining a copy
of this software and associated documentation files (the "Software"),
to work with the Software within the limits of freeware distribution and fair use.
This includes the rights to use, copy, and modify the Software for personal use.
Users are also allowed and encouraged to submit corrections and modifications
to the Software for the benefit of other users.

It is not allowed to reuse, modify, or redistribute the Software for
commercial use in any way, or for a user�s educational materials such as books
or blog articles without prior permission from the copyright holder.

The above copyright notice and this permission notice need to be included
in all copies or substantial portions of the software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


15 changes: 15 additions & 0 deletions README.md
@@ -0,0 +1,15 @@
#Apress Source Code

This repository accompanies [*Shell Scripting Recipes*](http://www.apress.com/9781590594711) by Chris Johnson (Apress, 2005).

![Cover image](9781590594711.jpg)

Download the files as a zip using the green button, or clone the repository to your machine using Git.

##Releases

Release v1.0 corresponds to the code in the published book, without corrections or updates.

##Contributions

See the file Contributing.md for more information on how you can contribute to this repository.
14 changes: 14 additions & 0 deletions contributing.md
@@ -0,0 +1,14 @@
# Contributing to Apress Source Code

Copyright for Apress source code belongs to the author(s). However, under fair use you are encouraged to fork and contribute minor corrections and updates for the benefit of the author(s) and other readers.

## How to Contribute

1. Make sure you have a GitHub account.
2. Fork the repository for the relevant book.
3. Create a new branch on which to make your change, e.g.
`git checkout -b my_code_contribution`
4. Commit your change. Include a commit message describing the correction. Please note that if your commit message is not clear, the correction will not be accepted.
5. Submit a pull request.

Thank you for your contribution!

0 comments on commit b39327a

Please sign in to comment.