Shell常识

来源:互联网 发布:开淘宝还能赚钱吗 编辑:程序博客网 时间:2024/04/29 13:38

. DOT and Subshell

. (dot) runs a shell script in the current environment and then returns. Normally, the shell runs a command file in a subshell so that changes to the environment by such commands as cd, set, and trap are local to the command file. The . (dot) command circumvents this feature. 

A subshell does not inherit the environment variables from parent process.


Fork - system call
fork() creates a new process by duplicating the calling process. The new process, referred to as the child, is an exact duplicate of the calling process. However, child process has its own process id.

&

The Bash & (ampersand) is a builtin control operator used to fork processes. From the Bash man page, "If a command is terminated by the control operator &, the shell executes the command in the background in a subshell".


$BASHPID

Process ID of the current instance of Bash. This is not the same as the $$ variable, but it often gives the same result.

[oracle@odilab ~]$ echo $BASHPID2540

$BASH_VERSION

The version of Bash installed on the system

[oracle@odilab ~]$ echo $BASH_VERSION4.1.2(1)-release

Bash快捷键:

CTRL + R

查找历史命令。输入要查找的命令,ctrl + r 返回最近一个命令。再按ctrl + r 查看其他的。

CTRL + W

输入命令时,删除一个单词

CTRL + U

输入命令时,删除当前整条命令

CTRL + A

光标跑到行首。相当于"Home"键。

cd -

进入上一次的工作目录






0 0
原创粉丝点击