Linux

Contents

Linux#


Bash#

Special parameters

  • $- the shell is interactive if the value contains an i

  • $? return value of previous command

  • $0 shell?

Builtin commands

  • sh

    • [ or test

    • . or source

    • :

    • break

    • cd

    • continue

    • eval

    • exec

    • exit

    • export

    • getopts

    • hash

    • pwd

    • readonly

    • return

    • set

    • shift

    • times

    • trap

    • umask

    • unset removes variables

  • bash

    • alias

    • bind

    • builtin

    • command

    • declare creates variables

    • echo

    • enable

    • help

    • let

    • local

    • logout

    • printf

    • read

    • shopt

    • type

    • typeset

    • ulimit

    • unalias

  • special

Environment variables

  • BASH_ENV

  • ENV

  • PATH

  • SHELL

  • SHELLOPTS

Conditional

  • [[ compound command

  • test builtin

  • [ builtin

  • unary, binary expression

  • unary expressions are often used to examine the status of a file

File descriptors

  • 0 /dev/stdin

  • 1 /dev/stdout

  • 2 /dev/stderr

  • N /dev/fd/N

Arithmetic

  • expansion

  • let builtin

  • evaluation is done in fixed-width integers with no check for overflow; division by zero is trapped and flagged as an error; operators and their precedence and associativity follow C

Arrays

  • one-dimensional

  • zero-indexed

  • declare builtin

directory stack

  • pushd builtin

  • popd builtin

  • dirs command

redirection

  • >

  • >|

  • ><

  • >&

  • &>

  • >>