ch02 脚本基础

✽内核是UNIX系统的心脏,它给工具提供了访问机器硬件的方式,还处理命令的调度和执行。关机后,内核和工具都被保存在硬盘中。但当计算机被引导时,内核从硬盘装载到内存中。内核将一直保留在内存中,直到关机。工具则存放在硬盘中仅在执行时载入到内存。
✽Shell在登录时被载入到内存;getty程序提示输入loginPassword登录(/etc/passwd);初始化shell,即定义Shell正确运行所需要的重要参数(读取/etc/profile以及.profile(在用户起始目录中,/home/susie ));Shell显示一个提示符$,提示用户可以输入要执行的命令。
✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -r $i ]; then . $i fi done unset i fi 
if [ "$PS1" ]; then if [ "$BASH" ]; then PS1='\u@\h:\w\$ ' if [ -f /etc/bash.bashrc ]; then  . /etc/bash.bashrc fi else if [ "`id -u`" -eq 0 ]; then PS1='# ' else PS1='$ ' fi fi fi umask 022 
✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽✽ # ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login # exists. # see /usr/share/doc/bash/examples/startup-files for examples. # the files are located in the bash-doc package. # the default umask is set in /etc/profile; for setting the umask # for ssh logins, install and configure the libpam-umask package. 
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
 . "$HOME/.bashrc"
    fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
export LANG="zh_CN.utf8"#!/bin/sh必须位于Shell脚本的第一行,以使用sh来运行脚本。如果在其他任何行中出现,所有Shell都会认为这是注释而将其忽略掉。

你可能感兴趣的:(ch02 脚本基础)