mirror of https://github.com/tLDP/LDP
Merge branch 'master' of github.com:tLDP/LDP
This commit is contained in:
commit
605cdea5a7
|
@ -576,7 +576,7 @@
|
|||
<para>Shell scripting hearkens back to the classic UNIX philosophy
|
||||
of breaking complex projects into simpler subtasks, of chaining
|
||||
together components and utilities. Many consider this a better,
|
||||
or at least more esthetically pleasing approach to problem solving
|
||||
or at least more aesthetically pleasing approach to problem solving
|
||||
than using one of the new generation of high-powered all-in-one
|
||||
languages, such as <firstterm>Perl</firstterm>, which attempt to
|
||||
be all things to all people, but at the cost of forcing you to
|
||||
|
|
|
@ -538,7 +538,7 @@ Functions
|
|||
</verb></tscreen>
|
||||
<P> Lines 2-4 contain the 'quit' function. Lines 5-7 contain the 'hello' function
|
||||
If you are not absolutely sure about what this script does, please try it!.
|
||||
<P> Notice that a functions don't need to be declared in any specific order.
|
||||
<P> Notice that functions don't need to be declared in any specific order.
|
||||
<P> When running the script you'll notice that first: the function 'hello' is
|
||||
called, second the 'quit' function, and the program never reaches line 10.
|
||||
</sect1>
|
||||
|
@ -626,7 +626,7 @@ Misc
|
|||
<!-- Reading user input -->
|
||||
<sect1>
|
||||
Reading user input with read
|
||||
<P> In many ocations you may want to prompt the user for some input, and
|
||||
<P> In many occasions you may want to prompt the user for some input, and
|
||||
there are several ways
|
||||
to achive this. This is one of those ways:
|
||||
<tscreen><verb>
|
||||
|
@ -661,7 +661,7 @@ Misc
|
|||
<P>
|
||||
<P> If you need to use fractions, or more math or you just want it, you
|
||||
can use bc to evaluate arithmetic expressions.
|
||||
<P> if i ran "echo $[3/4]" at the command prompt, it would return 0
|
||||
<P> If I ran "echo $[3/4]" at the command prompt, it would return 0
|
||||
because bash only uses integers when answering. If you ran
|
||||
"echo 3/4|bc -l", it would properly return 0.75.
|
||||
</sect1>
|
||||
|
@ -705,7 +705,7 @@ Misc
|
|||
<!-- Capturing a commands output -->
|
||||
<sect1>
|
||||
Capturing a commands output
|
||||
<P> This little scripts show all tables from all databases (assuming you got MySQL installed).
|
||||
<P> This little script shows all tables from all databases (assuming you got MySQL installed).
|
||||
Also, consider changing the 'mysql' command to use a valid username and password.
|
||||
<tscreen><verb>
|
||||
#!/bin/bash
|
||||
|
@ -799,9 +799,9 @@ Tables
|
|||
<sect1>
|
||||
Useful commands
|
||||
<P> This section was re-written by Kees (see thank to...)
|
||||
<P> Some of these command's almost contain complete programming languages.
|
||||
<P> Some of these commands almost contain complete programming languages.
|
||||
From those commands only the basics will be explained. For a more detailed
|
||||
description, have a closer look at the man pages of each command.
|
||||
description, have a closer look at the main pages of each command.
|
||||
|
||||
<bf/sed/ (stream editor)
|
||||
|
||||
|
@ -829,7 +829,7 @@ Tables
|
|||
|
||||
<P> Many implementations of the AWK programming language exist (most known interpreters are GNU's
|
||||
gawk and 'new awk' mawk.) The principle is simple: AWK scans for a pattern, and for every
|
||||
matching pattern a action will be performed.
|
||||
matching pattern an action will be performed.
|
||||
<P> Again, I've created a dummy file containing the following lines:
|
||||
<P> <it/"test123/
|
||||
<P> <it/test/
|
||||
|
@ -942,7 +942,7 @@ Tables
|
|||
</verb></tscreen>
|
||||
<it/80/
|
||||
<P> Shows the number of characters possible in x direction.
|
||||
<P> It it higly recommended to be familiarized with these programs (at least). There are tons of
|
||||
<P> It is higly recommended to be familiarized with these programs (at least). There are tons of
|
||||
little programs that will let you do real magic on the command line.
|
||||
<P> [some samples are taken from man pages or FAQs]
|
||||
</sect1>
|
||||
|
@ -1045,7 +1045,7 @@ More Scripts
|
|||
|
||||
# this for loop iterates through all of the files that we give the program
|
||||
# it does one rename per file given using the program 'sed'
|
||||
# this is a sinple command line program that parses standard input and
|
||||
# this is a simple command line program that parses standard input and
|
||||
# replaces a set expression with a give string
|
||||
# here we pass it the file name ( as standard input) and replace the nessesary
|
||||
# text
|
||||
|
|
Loading…
Reference in New Issue