标签 linux 下的文章

In bash, set +e is basically the default: If you get an error in a bash script, it normally barfs out an error to the system (this is called an exit code) but the script will continue running.

But if you want errors to cause the script immediately to exit then you can put set -e on a line to force your script to exit on errors from that point on.

*Using set -e should be carefully planned… you don’t want to stop on the first error and miss the second problem, which could something much worse:

(example)
set -e
dodge approaching car (*steering wheel error- abandon program, including the routine to slam on the breaks. You die.)

via quora:https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script

deb http://mirrors.aliyun.com/debian stretch main contrib non-free
deb http://mirrors.aliyun.com/debian stretch-proposed-updates main contrib non-free
deb http://mirrors.aliyun.com/debian stretch-updates main contrib non-free

deb-src http://mirrors.aliyun.com/debian stretch main contrib non-free
deb-src http://mirrors.aliyun.com/debian stretch-proposed-updates main contrib non-free
deb-src http://mirrors.aliyun.com/debian stretch-updates main contrib non-free

deb http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib

替换掉/etc/apt/sources.list即可

先获取到该进程号,然后执行:

ls -l /proc/xxx/fd

xxx为具体的进程号,输出例入下:

total 0
lr-x------ 1 namer namer 64 Jul 14 21:41 0 -> pipe:[271495439]
l-wx------ 1 namer namer 64 Jul 14 21:41 1 -> pipe:[271495440]
lr-x------ 1 namer namer 64 Jul 14 21:41 10 -> anon_inode:inotify
lrwx------ 1 namer namer 64 Jul 18 07:00 11 -> socket:[274231623]
l-wx------ 1 namer namer 64 Jul 16 17:27 12 -> /workspace/door-god/log/2017-07-18.log
l-wx------ 1 namer namer 64 Jul 17 23:05 13 -> /workspace/door-god/log/2017-07-18.log
lrwx------ 1 namer namer 64 Jul 18 11:30 14 -> socket:[274230820]
lrwx------ 1 namer namer 64 Jul 18 15:16 15 -> socket:[274234729]
lr-x------ 1 namer namer 64 Jul 16 07:36 16 -> /dev/urandom
l-wx------ 1 namer namer 64 Jul 14 21:41 2 -> pipe:[271495441]
lrwx------ 1 namer namer 64 Jul 14 21:41 3 -> socket:[274235127]
lrwx------ 1 namer namer 64 Jul 14 21:41 4 -> socket:[271495456]
lr-x------ 1 namer namer 64 Jul 14 21:41 5 -> anon_inode:inotify
lr-x------ 1 namer namer 64 Jul 14 21:41 7 -> anon_inode:inotify
lrwx------ 1 namer namer 64 Jul 14 21:41 8 -> anon_inode:[eventpoll]
lrwx------ 1 namer namer 64 Jul 14 21:41 9 -> socket:[271495458]

则为打开的文件数量,如果要快速获取文件数量,则可以:

ls -l /proc/xxx/fd|wc -l