This commit is contained in:
gferg 2002-01-07 15:24:19 +00:00
parent 2db81a6596
commit b32e9c2737
8 changed files with 726 additions and 83 deletions

View File

@ -2,6 +2,88 @@ RELEASE HISTORY
------- -------
Change log
Version 1.0.X interim release
1) Fix up comments in "weirdvars.sh" example.
2) In "Variables" chapter, slight wording change in first paragraph.
3) Slight changes to "ex9.sh" example.
4) Added redirection as an alternative remedy to the script hang problem with
background commands in "Job Control Commands" section of "Internal
Commands" chapter.
5) In "Text Processing Commands" section of "External Commands" chapter:
Added "-q" option at "grep", with in-line example.
Added usage example for "cut".
Much more information on "uniq -c", and added "wf.sh" example.
6) In "Functions" chapter:
Added more info on oversize (> 256) return values.
Modified "ex62.sh" example.
Reorganized "Local Variables" section.
Added note that before function call, all variables within functions
are local, not just those explicitly declared as such.
7) Add section on "Shell Scripting Under Windows" to "Miscellany" chapter.
8) In "String Manipulation" section of "Variables Revisited" chapter:
Bugfix in comment in "%%" substring removal example.
Added "cvt.sh" example at "%%" substring removal discussion.
Added subsection on using "awk" functionality for string manipulation,
with added "substring-extraction.sh" example.
9) In "$RANDOM" section of "Variables Revisited" chapter:
Removed superfluous "note" icon at beginning of section.
Added example of using "awk" rand() function to generate random numbers.
10) In "Command Substitution" chapter:
Added discussion and example of extending Bash toolset.
Added footnote about what exactly constitutes a "command".
11) In "System and Administrative Commands" chapter:
Added "lastlog" command.
More info on "route" and "netstat".
Fixed reference to "crond" at "logrotate".
Added "tmpwatch".
Added "sar".
12) In "Miscellaneous Commands" section of "External Commands" chapter,
added more info and an example to "dd".
13) In "Math Commands" section of "External Commands" chapter:
Added an alternative method of invoking 'bc', with "alt-bc.sh" example.
Added using "awk" math commands, with "hypotenuse.sh" example.
14) In "Archiving Commands" section of "External Commands" chapter,
added footnote to "tar".
15) In "Bibliography" section:
Cleaned up cross reference to University of Alberta site.
Added comp.unix.shell newsgroup reference.
16) Made corrections to "symlinks.sh" and "symlinks2.sh" examples,
per Dominik 'Aeneas' Schnitzer.
17) In "Starting Off With a Sha-Bang" chapter, clarified footnote explaining
"magic numbers", per Stanislav Brabec's suggestion.
18) In "I/O Redirection" chapter, added stdout redirection instance, with
example.
19) In "Sed and Awk Micro-Primer" appendix:
Added $filename to in-line examples.
Fixup on "END" command block description.
20) Added semicolons as necessary to terminate commands in Perl examples.
21) Added "History Commands" appendix.
Version 1.0 (stable!), released 10/14/01
1) Quoted "$LOGFILE" in in-line example in "Scripting With Style" subsection

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
echo "This precedes the embedded Perl script within \"$0\"."
echo "==============================================================="
perl -e 'print "This is an embedded Perl script\n"'
perl -e 'print "This is an embedded Perl script.\n";'
# Like sed, Perl also uses the "-e" option.
echo "==============================================================="

View File

@ -2,17 +2,24 @@
func ()
{
local a=23
echo
echo "a in function = $a"
local loc_var=23 # Declared local.
echo
echo "\"loc_var\" in function = $loc_var"
global_var=999 # Not declared local.
echo "\"global_var\" in function = $global_var"
}
func
# Now, see if local 'a' exists outside function.
echo "a outside function = $a" # Nope, 'a' not visible globally.
echo
echo "\"loc_var\" outside function = $loc_var"
# "loc_var" outside function =
# Nope, $loc_var not visible globally.
echo "\"global_var\" outside function = $global_var"
# "global_var" outside function = 999
# $global_var is visible globally.
echo
exit 0

View File

@ -25,9 +25,15 @@ echo ${hello} #Identical to above.
echo "$hello"
echo "${hello}"
# hello="A B C D"
echo
hello="A B C D"
echo $hello
echo "$hello"
# Now, echo $hello and echo "$hello" give different results.
# Quoting variable preserves whitespace.
# Quoting a variable preserves whitespace.
echo
echo '$hello'
# Variable referencing disabled by single quotes,

View File

@ -12,10 +12,10 @@ fi
echo "symbolic links in directory \"$directory\""
for file in $( find $directory -type l ) # -type l = symbolic links
for file in "$( find $directory -type l )" # -type l = symbolic links
do
echo "$file"
done | sort # Otherwise file list is unsorted.
done | sort # Otherwise file list is unsorted.
# As Dominik 'Aeneas' Schnitzer points out,
#+ failing to quote $( find $directory -type l )

View File

@ -13,10 +13,10 @@ fi
echo "symbolic links in directory \"$directory\""
for file in $( find $directory -type l ) # -type l = symbolic links
for file in "$( find $directory -type l )" # -type l = symbolic links
do
echo "$file"
done | sort > "$OUTFILE" # stdout of loop
# ^^^^^^^^^^^^ redirected to save file.
done | sort > "$OUTFILE" # stdout of loop
# ^^^^^^^^^^^^ redirected to save file.
exit 0

View File

@ -5,9 +5,11 @@ var="'(]\\{}\$\""
echo $var # '(]\{}$"
echo "$var" # '(]\{}$" Doesn't make a difference.
echo
IFS='\'
echo $var # '(]\{}$" \ converted to space.
echo "$var" # '(] {}$"
echo $var # '(] {}$" \ converted to space.
echo "$var" # '(]\{}$"
# Examples above supplied by S.C.