SHELL PROGRAMMING QUICK REFERENCE GUIDE

SHELL PROGRAMMING QUICK REFERENCE GUIDE SPECIAL CHARACTERS ; command separator () execute commands in subshell {} execute commands in current shell # comments $var variable & execute in the background ` substitute standard out ‘ quote all characters in a string “ as ‘ but allow substitution REGULAR EXPRESSIONS . match any single character $ match preceding regular expression at the end of a line ^ match preceding regular expression at the beginning of a line * match zero or more occurrences of preceding expression [] match any character in the brackets (or range, i.e. 2-8) [^ ] match any character not in brackets (i.e., ^0-9 means nonnumeric character) \\ last regular expression encountered \(exp\) remember expression for later reference \{m,n\} number of times occurring, with m \{m\} indicating minimum and n \{m,\} indicating maximum COMMANDS exit code Exit shell with code return code break level Escape from level of for or while loop continue level Continue from level of for or while loop read Read input from a file test Evaluate an expression or condition trap Used for error handling LOOPING FOR for variable in file/list do command done WHILE/UNTIL while/until test/condition do command done CASE case option in option1) command;; option2) command;; *) command;; esac (* is any non-defined option) IF if test/condition then command elif test/expression then command else command fi REPETITION xargs -n (see man page for more options) VARIABLE EXPANSION ${var} simple variable substitution ${var:=value} assign default value if not defined ${var:+value} substitute value if var is non-null ${var:-value} temporarily assign value if non-null ${var:?value} issue error with value if var not set, otherwise substitute value Compiled by Michael Oliveri (www.mikeoliveri.com) Feel free to print a copy for yourself!

Related docs
Quick Reference
Views: 36  |  Downloads: 10
Python Quick Reference Guide
Views: 607  |  Downloads: 17
Quick Reference
Views: 343  |  Downloads: 3
QUICK REFERENCE FOR
Views: 53  |  Downloads: 2
Linux Quick Reference Guide
Views: 3  |  Downloads: 0
Quick Reference Guide
Views: 2  |  Downloads: 0
Quick Reference Guide
Views: 25  |  Downloads: 1
Quick Reference Guide
Views: 9  |  Downloads: 0
Teach Yourself Shell Programming in 24 Hours
Views: 80  |  Downloads: 3
Linux Security Quick Reference Guide
Views: 40  |  Downloads: 12
Beej's Guide to C Programming
Views: 130  |  Downloads: 21
Other docs by techmaster
Prenatal Massage Therapy
Views: 666  |  Downloads: 18
Aronson Evidence Outline
Views: 510  |  Downloads: 18
Resources for Organizational Behavior
Views: 562  |  Downloads: 17
Trespassers
Views: 147  |  Downloads: 1
Cause-in-fact
Views: 665  |  Downloads: 11
Learn Italian
Views: 1219  |  Downloads: 61
dv210infoc
Views: 88  |  Downloads: 0
dv500infoc
Views: 97  |  Downloads: 0
Burnham v S C of CA
Views: 299  |  Downloads: 5
dv145
Views: 123  |  Downloads: 0
de350
Views: 97  |  Downloads: 0
I Exalt Thee
Views: 191  |  Downloads: 0
French to English Food Glossary
Views: 1918  |  Downloads: 87
Anjou Joye Ortega Jasko Byrne
Views: 228  |  Downloads: 2
de122
Views: 105  |  Downloads: 0