bash: general

  • to login
    • Interactive shell
      • ~/.bashrc: launch settings, will execuate these command while launch
    • login shell
      • ~/.bash_profile: login settings, will execuate these command while login
    • GNOME, KDE..
      • when login these Graphic Interface, mostly, the created terminal is not login shell
      • So they will not read .profile or .bash_profile
    • ssh remote login system will read .profile 
  • knowledge
    • file hander is the integer which is related with input stream and output stream
  • Terminal prompt
    • $: for normal user
    • #: for root user
  • pay attention
    • var = value: with a blank space on both side of "=": to test equivalence
    • var=value: no blank space: assignment
    • [$var -eq 0 ] or [ $var -eq 0]: must have a space beside [ or ]
  • system issues
    • /bin: binary files, using commands here, shell will always launch a new process. So using commands here is slower to use built-in commands
  • special path
    • /proc/$PID/environ: process environment
    • /etc/environment
    • /etc/security/limits.conf
    • /dev/null: discard all received data
    • /dev/stdin, /dev/stdout, /dev/stderr
  • exit status
    • command fail: return none zero value
    • command pass: return 0
    • $?: to get the exit status
  • echo "<string>" or '<string>' or <string>
    • " " will explain special charcter of <string>
    • ' ' will not explain anything
    • <string> can't contain semicolon
  • special character
    • $?: to get exit status
    • $0: the script's name
    • $n: nth parameter
    • $@: parameters, to recognize as a list as "$1" "$2" "$3"...
    • $*: parameters, to recognize as "$1c$2c$3", c is the first character in IFS
    • $#: number of parameter
    • $!: get the latest background run process's PID
    • : : tell shell to do nothing
    • IFS: Internal Field Separator:defalult is a blank character (\n, \t, \s)
    • PS1: environment to set shell prompt in command line 
  • environment variable
    • HOME
    • PWD
    • USER
    • UID: user id
    • SHELL
    • PATH: exectuable files' path
    • LD_LIBRARY_PATH: lib files' path

  

posted @ 2020-10-08 18:00  cynn  阅读(75)  评论(0)    收藏  举报