1 / 11

The UNIX Shells

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. Korn Shell. C Shell. Common Core. Bourne Shell. Shell. User. Resident modules. Kernel.

Download Presentation

The UNIX Shells

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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. Korn Shell C Shell Common Core Bourne Shell

  3. Shell User Resident modules Kernel Hardware

  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

More Related