Bash

  • bash is a descendant of sh.

  • Shell variables are known only to the local shell and are not passed on to other processes.

  • Environment variables are passed on to other processes.

  • A shell variable is made an environment variable when it is exported.

  • This sets a shell variable:

    # PI=3.14
  • This turns it into an environment variable:

    # export PI
  • This definition does both at the same time:

    # export PI=3.14
  • Shell aliases conveniently create new commands or modify existing commands:

    # alias more='less'
  • Functions are defined for and called in scripts. This line creates a function named lsps:

    # lsps () { ls -l; ps; }
  • bash configuration files control the shell’s behavior. Table 13-1 contains a list of these files.

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.