Learning the bash Shell – (Reading Notes)

This are some summary notes while reading the book. Written by Cameron Newbam & Bill Rosenblantt.

0. Summary of bash features:

(features common with C shell):
– Directory manipulation (pushd, popd, dirs)
– Job control (fg, bg), also stop jobs with CTRL-Z
– Brace expansion (generating arbitrary strings)
– Tilde expansion, shorthand way to refer to directories
– Aliases, used to define shorthand names for commands/command lines
– Command history
(bash’s major new features):
– command-line editing (vi-, emacs-style)
– key bindings
– integrated programming features (UNIX with Shell)
– control structures (select construct, easy menu generation)
– new options and variables (env customization)
– 1D arrays that allow easy referencing and manipulation of lists of data
– dynamic loading of built-ins (also can write your own and load them into running shell)

Chapter 1

  • a shell is any user interface to the UNIX operating system
  • There are various types of user interface. Bash belongs to the most common category, know as character-based user interface. (other example: GUI)

Interactive Shell Use:
open up terminal, type ‘bash‘ to enter shell programming mode. To exit, type ‘exit‘ or ‘logout‘ or press CTRL-D.

Shell command line consist of one or more words. The first word is ‘command’ and the following are ‘arguments (parameters)’.
e.g. lp myfile
lp: print a file
myfile: the name of a file to print

An ‘option’ is a special type of argument that gives the command specific information on what it is supposed to do. (usually starts with a dash)

e.g. lp -h myfile
-h myfile: tells lp not to print the ‘banner page’ before it prints the file

e.g.2 lp -d lp1 -h myfile
-d lp1: send the output to the printer called lp1
-h myfile: same as above

Files

  • Regular Files
  • Executable Files
  • Directories

Leave a Reply

Your email address will not be published. Required fields are marked *