NP Completeness

NP完全性的核心逻辑

NP完全问题是为了反映一个问题有多难,而不是为了反应它有多简单

Variables in Linux

Types of variables

  1. Environment/Global Variables
  2. Shell/Local Variables

The difference between these two variables is that environment variables can be interviewed by child processes, i.e. the so-called global variables are only shared within the process hierarchy of the current process(进程链), existing only between the current process and its child processes. Environment variables of other processes and those of the current process are not shared. But Shell variables can only be interviewed by current process.

Makefile

variables1

It should be noted that the usage of site a variable in makefile is different from using it in shell.

Comparison of Shell Script Execution Modes

方法概览

1
% echo "echo 'Hello Script'" > script.sh

方式1:直接运行可执行文件

1
2
3
% chmod +x script.sh
% ./script.sh
Hello Script

方式2:使用命令 sh 或 bash

1
2
3
4
5
% sh script.sh
Hello Script

% bash script.sh
Hello Script

方式3:使用命令 source 或 .

1
2
3
4
5
% source script.sh
Hello Script

% . ./script.sh
Hello Script

两种分类方法

是否需要执行权限

只有方式1需要执行权限。这是因为方式1把脚本作为可执行文件,自然需要执行权限,但方式2和方式3都是把脚本作为命令的参数,可以不具备执行权限

0%