45
Double-quoting the backslash (\) character
•
Double-spacing a text file, using sed
* * *
-e File exists test
echo
Feeding commands down a pipe
•
Setting a variable using command substitution
•
/bin/echo, external echo command
•
elif, Contraction of else and if
else
Encrypting files, using openssl
esac, keyword terminating case construct
Environmental variables
-eq , is-equal-to integer comparison test
Eratosthenes, Sieve of, algorithm for generating prime numbers
Escaped characters, special meanings of
Within $' ... ' string expansion
•
Used with Unicode characters
•
/etc/fstab (filesystem mount) file
/etc/passwd (user account) file
$EUID, Effective user ID
eval, Combine and evaluate expression(s), with variable expansion
Effects of, Example script
•
Forces reevaluation of arguments
•
And indirect references
•
Risk of using
•
Using eval to convert array elements into a command list
•
Using eval to select among variables
•
Evaluation of octal/hex constants within [[ ... ]]
exec command, using in redirection
Advanced Bash-Scripting Guide
Appendix T. ASCII Table
875
43
Exercises
Exit and Exit status
exit command
•
Exit status (exit code, return status of a command)
Table, Exit codes with special meanings
Anomalous
Out of range
Pipe exit status
Specified by a function return
Successful, 0
/usr/include/sysexits.h, system file listing C/C++ standard exit codes
•
Export, to make available variables to child processes
Passing a variable to an embedded awk script
•
expr, Expression evaluator
Substring extraction
•
Substring index (numerical position in string)
•
Substring matching
•
Extended Regular Expressions
? (question mark) Match zero / one characters
•
( ... ) Group of expressions
•
\{ N \} "Curly" brackets, escaped, number of character sets to match
•
+Character match
•
* * *
factor, decomposes an integer into its prime factors
Application: Generating prime numbers
•
false, returns unsuccessful (1) exit status
Field, a group of characters that comprises an item of data
Files / Archiving
File descriptors
Advanced Bash-Scripting Guide
Appendix T. ASCII Table
876
54
Closing
n<&- Close input file descriptor n
0<&-, <&- Close stdin
n>&- Close output file descriptor n
1>&-, >&- Close stdout
•
File handles in C, similarity to
•
File encryption
find
{} Curly brackets
•
\; Escaped semicolon
•
Filter
Using - with file-processing utility as a filter
•
Feeding output of a filter back to same filter
•
Floating point numbers, Bash does not recognize
fold, a filter to wrap lines of text
Forking a child process
for loops
Functions
Arguments passed referred to by position
•
Capturing the return value of a function using echo
•
Colon as function name
•
Definition must precede first call to function
•
Exit status
•
Local variables
and recursion
•
Passing an array to a function
•
Passing pointers to a function
•
Positional parameters
•
Recursion
•
Redirecting stdin of a function
•
return
Multiple return values from a function, example script
Returning an array from a function
•
Advanced Bash-Scripting Guide
Appendix T. ASCII Table
877
66
Return range limits, workarounds
Shift arguments passed to a function
•
Unusual function names
•
* * *
Games and amusements
Anagrams
•
Anagrams, again
•
Bingo Number Generator
•
Crossword puzzle solver
•
Crypto-Quotes
•
Dealing a deck of cards
•
Fifteen Puzzle
•
Horse race
•
Knight's Tour
•
"Life" game
•
Magic Squares
•
Music-playing script
•
• Nim
Pachinko
•
Perquackey
•
Petals Around the Rose
•
Podcasting
•
Poem
•
Speech generation
•
Towers of Hanoi
Graphic version
Alternate graphic version
•
getopt, external command for parsing script command-line arguments
Emulated in a script
•
getopts, Bash builtin for parsing script command-line arguments
$OPTIND / $OPTARG
•
Global variable
Globbing, filename expansion
Handling filenames correctly
•
Wild cards
•
Will not match dot files
•
Golden Ratio (Phi)
Advanced Bash-Scripting Guide
Appendix T. ASCII Table
878
C# PowerPoint - Insert Blank PowerPoint Page in C#.NET This C# .NET PowerPoint document page inserting & adding component from RasterEdge is written in managed C# code and designed particularly for .NET class
how to add text fields to a pdf document; how to add text to pdf file with reader
43
-ge , greater-than or equal integer comparison test
-gt , greater-than integer comparison test
groff, text markup and formatting language
Gronsfeld cipher
$GROUPS, Groups user belongs to
gzip, compression utility
* * *
Hashing, creating lookup keys in a table
Example script
•
head, echo to stdout lines at the beginning of a text file
help, gives usage summary of a Bash builtin
Here documents
Anonymous here documents, using :
Commenting out blocks of code
Self-documenting scripts
•
bc in a here document
•
cat scripts
•
Command substitution
•
ex scripts
•
Function, supplying input to
•
Here strings
Calculating the Golden Ratio
Prepending text
As the stdin of a loop
Using read
•
Limit string
! as a limit string
Closing limit string may not be indented
Dash option to limit string, <<-LimitString
•
Literal text output, for generating program code
•
Advanced Bash-Scripting Guide
Appendix T. ASCII Table
879
C# Word - Insert Blank Word Page in C#.NET This C# .NET Word document page inserting & adding component from RasterEdge is written in managed C# code and designed particularly for .NET class applications
adding text box to pdf; add text to pdf file reader C# PowerPoint - How to Process PowerPoint slides/pages in the simplest procedures, for instance, using online clear C# methods to add, insert or delete any specific PowerPoint slide, adding & burning
how to add text field to pdf; how to add text box to pdf
40
Parameter substitution
Disabling parameter substitution
•
Passing parameters
•
Temporary files
•
Using vi non-interactively
•
History commands
$HOME, user's home directory
Homework assignment solver
$HOSTNAME, system host name
* * *
$Id parameter, in rcs (Revision Control System)
if [ condition ]; then ... test construct
if-grep, if and grep in combination
Fixup for if-grep test
•
$IFS, Internal field separator variable
Defaults to whitespace
•
Integer comparison operators
in, keyword preceding [list] in a for loop
Initialization table, /etc/inittab
Inline group, i.e., code block
Interactive script, test for
I/O redirection
Indirect referencing of variables
New notation, introduced in version 2 of Bash ( example script)
•
iptables, packet filtering and firewall utility
Usage example
•
Example script
•
Iteration
Advanced Bash-Scripting Guide
Appendix T. ASCII Table
880
39
* * *
Job IDs, table
jot, Emit a sequence of integers. Equivalent to seq.
Random sequence generation
•
Just another Bash hacker!
* * *
Keywords
error, if missing
•
kill, terminate a process by process ID
Options (-l, -9)
•
killall, terminate a process by name
killall script in /etc/rc.d/init.d
* * *
lastpipe shell option
-le , less-than or equal integer comparison test
let, setting and carrying out arithmetic operations on variables
C-style increment and decrement operators
•
Limit string, in a here document
$LINENO, variable indicating the line number where it appears in a script
Link, file (using ln command)
Invoking script with multiple names, using ln
•
symbolic links, ln -s
•
List constructs
And list
•
Or list
•
Local variables
and recursion
•
Advanced Bash-Scripting Guide
Appendix T. ASCII Table
881
46
Localization
Logical operators (&&, ||, etc.)
Logout file, the ~/.bash_logout file
Loopback device, mounting a file on a block device
Loops
break loop control command
•
continue loop control command
•
C-style loop within double parentheses
for loop
while loop
•
do (keyword), begins execution of commands within a loop
•
done (keyword), terminates a loop
•
for loops
for arg in [list]; do
Command substitution to generate [list]
Filename expansion in [list]
Multiple parameters in each [list] element
Omitting [list], defaults to positional parameters
Parameterizing [list]
Redirection
•
in, (keyword) preceding [list] in a for loop
•
Nested loops
•
Running a loop in the background, script example
•
Semicolon required, when do is on first line of loop
for loop
while loop
•
until loop
until [ condition-is-true ]; do
•
while loop
while [ condition ]; do
Function call inside test brackets
•
Advanced Bash-Scripting Guide
Appendix T. ASCII Table
882
36
Multiple conditions
Omitting test brackets
Redirection
while read construct
Which type of loop to use
•
Loopback devices
In /dev directory
•
Mounting an ISO image
•
-lt , less-than integer comparison test
* * *
m4, macro processing language
$MACHTYPE, Machine type
Magic number, marker at the head of a file indicating the file type
Makefile, file containing the list of dependencies used by make command
man, manual page (lookup)
Man page editor (script)
•
mapfile builtin, loads an array with a text file
Math commands
Meta-meaning
Morse code training script
Modulo, arithmetic remainder operator
Application: Generating prime numbers
•
Mortgage calculations, example script
* * *
-n String not null test
Named pipe, a temporary FIFO buffer
Example script
•
Advanced Bash-Scripting Guide
Appendix T. ASCII Table
883
35
nc, netcat, a network toolkit for TCP and UDP ports
-ne, not-equal-to integer comparison test
Negation operator, !, reverses the sense of a test
netstat, Network statistics
Network programming
nl, a filter to number lines of text
Noclobber, -C option to Bash to prevent overwriting of files
NOT logical operator, !
null variable assignment, avoiding
* * *
-o Logical OR compound comparison test
Obfuscation
Colon as function name
•
Homework assignment
•
Just another Bash hacker!
•
octal, base-8 numbers
od, octal dump
$OLDPWD Previous working directory
openssl encryption utility
Operator
Definition of
•
Precedence
•
Options, passed to shell or script on command line or by set command
Or list
Or logical operator, ||
* * *
Parameter substitution
Advanced Bash-Scripting Guide
Appendix T. ASCII Table
884
Documents you may be interested
Documents you may be interested