Scripting in general... Concept of "the shell" What are some of the things you can do Commonly used tools in shell scripts sed - Stream EDitor awk/gawk - pattern scanning and processing language tr - translate or delete characters dc - arbitrary precision calculator bc - arbitrary precision calculator language grep/egrep/fgrep/rgrep Languages we might use... bash/sh perl advantages disadvantages shell scripts ----------- When not to use shell scripts * Resource-intensive tasks, especially where speed is a factor (sorting, hashing, etc.) * Procedures involving heavy-duty math operations, especially floating point arithmetic, arbitrary precision calculations, or complex numbers (use C++ or FORTRAN instead) * Cross-platform portability required (use C or Java instead) * Complex applications, where structured programming is a necessity (need type-checking of variables, function prototypes, etc.) * Mission-critical applications upon which you are betting the ranch, or the future of the company * Situations where security is important, where you need to guarantee the integrity of your system and protect against intrusion, cracking, and vandalism * Project consists of subcomponents with interlocking dependencies * Extensive file operations required (Bash is limited to serial file access, and that only in a particularly clumsy and inefficient line-by-line fashion) * Need native support for multi-dimensional arrays * Need data structures, such as linked lists or trees * Need to generate or manipulate graphics or GUIs * Need direct access to system hardware * Need port or socket I/O * Need to use libraries or interface with legacy code * Proprietary, closed-source applications (shell scripts put the source code right out in the open for all the world to see) Perl ---- * Encourages lazy or non-optimal code * Not as efficient as a compiled language * Weak typing * Hard to read and maintain code * Lack of authoring tools