mirror of https://github.com/tLDP/LDP
updated
This commit is contained in:
parent
2db81a6596
commit
b32e9c2737
|
@ -2,6 +2,88 @@ RELEASE HISTORY
|
||||||
------- -------
|
------- -------
|
||||||
Change log
|
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
|
Version 1.0 (stable!), released 10/14/01
|
||||||
|
|
||||||
1) Quoted "$LOGFILE" in in-line example in "Scripting With Style" subsection
|
1) Quoted "$LOGFILE" in in-line example in "Scripting With Style" subsection
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@
|
||||||
echo "This precedes the embedded Perl script within \"$0\"."
|
echo "This precedes the embedded Perl script within \"$0\"."
|
||||||
echo "==============================================================="
|
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.
|
# Like sed, Perl also uses the "-e" option.
|
||||||
|
|
||||||
echo "==============================================================="
|
echo "==============================================================="
|
||||||
|
|
|
@ -2,17 +2,24 @@
|
||||||
|
|
||||||
func ()
|
func ()
|
||||||
{
|
{
|
||||||
local a=23
|
local loc_var=23 # Declared local.
|
||||||
echo
|
|
||||||
echo "a in function = $a"
|
|
||||||
echo
|
echo
|
||||||
|
echo "\"loc_var\" in function = $loc_var"
|
||||||
|
global_var=999 # Not declared local.
|
||||||
|
echo "\"global_var\" in function = $global_var"
|
||||||
}
|
}
|
||||||
|
|
||||||
func
|
func
|
||||||
|
|
||||||
# Now, see if local 'a' exists outside function.
|
# 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
|
echo
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -25,9 +25,15 @@ echo ${hello} #Identical to above.
|
||||||
echo "$hello"
|
echo "$hello"
|
||||||
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.
|
# Now, echo $hello and echo "$hello" give different results.
|
||||||
# Quoting variable preserves whitespace.
|
# Quoting a variable preserves whitespace.
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
echo '$hello'
|
echo '$hello'
|
||||||
# Variable referencing disabled by single quotes,
|
# Variable referencing disabled by single quotes,
|
||||||
|
|
|
@ -12,7 +12,7 @@ fi
|
||||||
|
|
||||||
echo "symbolic links in directory \"$directory\""
|
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
|
do
|
||||||
echo "$file"
|
echo "$file"
|
||||||
done | sort # Otherwise file list is unsorted.
|
done | sort # Otherwise file list is unsorted.
|
||||||
|
|
|
@ -13,7 +13,7 @@ fi
|
||||||
|
|
||||||
echo "symbolic links in directory \"$directory\""
|
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
|
do
|
||||||
echo "$file"
|
echo "$file"
|
||||||
done | sort > "$OUTFILE" # stdout of loop
|
done | sort > "$OUTFILE" # stdout of loop
|
||||||
|
|
|
@ -5,9 +5,11 @@ var="'(]\\{}\$\""
|
||||||
echo $var # '(]\{}$"
|
echo $var # '(]\{}$"
|
||||||
echo "$var" # '(]\{}$" Doesn't make a difference.
|
echo "$var" # '(]\{}$" Doesn't make a difference.
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
IFS='\'
|
IFS='\'
|
||||||
echo $var # '(]\{}$" \ converted to space.
|
echo $var # '(] {}$" \ converted to space.
|
||||||
echo "$var" # '(] {}$"
|
echo "$var" # '(]\{}$"
|
||||||
|
|
||||||
# Examples above supplied by S.C.
|
# Examples above supplied by S.C.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue