Home Page Icon
Home Page
Table of Contents for
Logical AND
Close
Logical AND
by Giorgio Zarrelli
Mastering Bash
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
Let's Start Programming
I/O redirection
Messing around with stdin, stdout, and stderr
Time for the interpreter: the sha-bang
Calling your script
Something went wrong, let's trace it
Variables
Assigning a variable
Keep the variable name safe
Variables with limited scope
Environment variables
Variable expansion
Pattern matching against variables
Special variables
Summary
Operators
Arithmetic operators
The + operator
The - operator
The * operator
The / operator
The % operator
The ** operator
Assignment operators
The += operator
The -= operator
The *= operator
The /= operator
The %= operator
The ++ or -- operators
Bitwise operators
Left shift (<<)
Right shift (>>)
Bitwise AND
Bitwise OR (|)
Bitwise XOR (^)
Bitwise NOT (~)
Logical operators
Logical NOT (!)
Logical AND
Logical OR (||)
Comma operator (,)
Operators evaluation order and precedence in decreasing relevance
Exit codes
Exiting a script
Summary
Testing
What if...else
Test command recap
Testing files
Testing integers
Testing strings
More on tests
Summary
Quoting and Escaping
Special characters
The hash character (#)
The semicolon character (;)
The double semicolon character (;;)
The case terminator (;;&) and (;&))
The dot character (.)
The double quotes ("...")
The single quotes ('...')
The comma character (,)
The ,, and , () case modificators
The ^^ and ^ () case modificators
The backslash ()
The forward slash (/)
'...'
The colon character (:)
The exclamation (!)
Keywords
The asterisk (*)
The double asterisk (**)
Test operators (?)
The substitution ($)
The parameter substitution (${})
The quoted string expansion ($'...')
The positional parameters ($* and $")
The exit status ($?)
The process ID ($$)
Grouping the command (command1 ; command2 ; commandn)
Braces ({})
The full path ({} ;)
Expression ([])
Expression ([[]])
The array index ([])
Characters range ([])
Integer expansion ($[…])
Integer expansion (((..)))
DEMO
The here document (<<)
The here string (<<<)
The ASCII comparison operators (<) and (>)
Delimiters (< and >)
The pipe character (|)
The force redirection (>|)
The logical OR (||)
DEMO
Logical AND
The dash character (-)
The double dash (--)
Operator =
Operator +
The modulo operator (%)
Operator ~
Operator ~+
Operator ~-
Operator ~=
Operator ^
The control characters (^ and ^^)
Quoting and escaping
The backslash ()
Double quotes ("")
Single quotes (')
Summary
Menus, Arrays, and Functions
The case statement
Arrays
Functions
Summary
Iterations
The for loop
Let's do something while, until…
Exiting the loop with break and continue
Time to give our client a menu
CLI, passing the arguments to the command line
Summary
Plug into the Real World
What is Nagios?
Active and passive checks
Active checks
Passive checks
Returning code and thresholds
Command and service definitions
Our first Nagios plugin
Summary
We Want to Chat
The Slack messaging service
Slack WebHooks
What is a JSON?
Do you like cURLing?
Formatting our messages
Message attachments
Our wee chatty script for Slack
Summary
Subshells, Signals, and Job Controls
What is a subshell?
Background processes
Signals
Job controls
Subshells and parallel processing
Summary
Lets Make a Process Chat
Pipes
Redirection to a file
The command substitution
The process substitution
Environment variables
Coprocesses
/dev/tcp and /dev/udp
Netcat
Summary
Living as a Daemon
What is a daemon?
DEMO
nohup
disown
Double fork and setsid
Becoming a daemon
Trapping a daemon
Going dark with the daemon
Summary
Remote Connections over SSH
What is SSH?
Configuration files
The sshd_config file
ssh_config
Passwordless connections
Configuring the server
Preparing the remote account
Configuring the client
Proxies and tunnels
Summary
Its Time for a Timer
One shot at it
The cron scheduler
cron
Summary
Time for Safety
The restricted shell
Restricted shells for OpenSSH
Restricted sftp sessions with OpenSSH
Summary
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
DEMO
Next
Next Chapter
The dash character (-)
Logical AND
This is the logical AND, and it returns
true
in a test if both the conditions are true.
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset