Download presentation
Presentation is loading. Please wait.
1
The UNIX Shells 1. What is a Unix shell? 2. A few common shells in the Unix & Linux. A. Bourne shell B. Korn shell C. C shell D. Bash-the default shell on most Linux
2
Common Core Bourne Shell C Shell Korn Shell
3
Kernel User Resident modules Hardware Shell
4
Shell Functions (Core) Built-in commands, Scripts, Redirection Wildcards, Pipes, Subshells Background processing Command substitution Variables (Local & Environment) Sequences (Conditional & Unconditional)
5
Selecting A Shell 1. Password is required to change shell 2. Utility: use chsh & input password Bunrne --- /bin/sh C --- /bin/csh Korn --- /bin/ksh (not avl. Here) Bash --- /bin/bash (Default for most of the Linux)
6
Utilities & Shell Commands In general, we don’t differentiate utilities & commands. In most of the books, both mean the same thing. They are utility programs to fulfill certain functions such as: Text editing, File manipulation, email… …
7
Metacharacters > --- Output redirection >> --- Output redirection-append to a file < --- Input redirection (Read standard input from a file) * --- File-substitution (similar to DOS) ? --- File-substitution (single character) | --- Pipe symbol (one out to another in)
8
More Metacharacters || --- Conditional execution (executes a command if the previous one fails) && --- Opposite to || & ---Runs a command in the background # --- Comment $ --- Expends the value of a variable \ --- Disables the special meaning of next Char.
9
More … … Metacharacters ; --- To sequence commands (…) --- Groups commands […] --- File substitution wildcard `command` --- Command substitution; replaced by the output from command <<tok --- Input redirection; reads standard input from script up to tok
10
Examples 1. cat > file_1 You already familiar with 2. cat >> file_1 ; appends new typed contents to the existing file_1 3. ls file* list all files with file the first part of the name 4. ls ?ile2 5. ls file3 | wc 6. sleep 30 & sleep 30 second in the background
11
More examples of using metacharacters date; pwd; ls; cal--execute them in sequence ls [ac]* -- list any string beginning with “a” or “c” echo the date today is `date` ls */*.c --- list all files ending in “.c” in any subdirectory ls [A-Za-z]* --- list any string begin with a letter
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.