Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shell 编程笔记 #2

Open
sonofspring2 opened this issue Nov 11, 2018 · 0 comments
Open

shell 编程笔记 #2

sonofspring2 opened this issue Nov 11, 2018 · 0 comments

Comments

@sonofspring2
Copy link
Owner

sonofspring2 commented Nov 11, 2018

进程管理

ps -l : 只有列出和目前相关的进程。
ps aux: 列出所有的进程哦,注意没有 -

test, && 和 ||

test 可以有个返回值哦。
&& 当前面的判断为真的时候,执行命令。
|| 当前面的判断为假的时候,执行命令。
&&||常常可以连在一起用。

test -e ./p1.log &&echo "exit" || echo "not exit"; touch p1.log

$() 和${}

$() 和原来的 ``一样,表示的要 evaluate 一下表达式的值。
${} 只是字符串的替换,或者变量的替换。

$(()) 和 (())

注意:
(()) 之间没有空格!!!!
但是它们中间的表达式可以有任意的空格。

declare 和普通的定义

declare 可以定义各种变量,比如整数。 -i选项。

$RANDOM

$RANDOM 可以得到内置的一个随机数哦。

system service

all system service is under /etc/init.d directory. d stands for daemon.
systemctl 可以管理 系统的service

systemctl COMMAND unit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant