https://superuser.com/questions/403516/exclude-dash-fro …
继续阅读“Exclude dash (-) from word separators in vi – Super User”
DevOps
https://superuser.com/questions/403516/exclude-dash-fro …
继续阅读“Exclude dash (-) from word separators in vi – Super User”
一般来讲,/bin/sh 都是软连接到bash的,所以,你基本上会认为 /bin/sh 和 /bin/bash …
不惑: shell函数中可以使用return语句提前返回 疑惑:有些shell脚本中,函数外也会出现retur …
如下,获取数组中的前2个元素:
1 2 3 4 5 6 |
bash-4.1# php -r 'print_r(array_chunk(array('a'=>1,'b'=>2,'c'=>3),2,true)[0]);' Array ( [a] => 1 [b] => 2 ) |
难道还有更方 …
先看两个例子: basename 和 printf 都是常用的命令,怎么还能出问题? 对于shell来讲,参数 …
下载文件时,最好有断点续传的功能,免得下载了一部分断掉了导致前功尽弃,curl就支持断点续传; 文件copy时 …
https://item.jd.com/1179011.html 读速度: 60MB/s 写速度 …
有一种文件下载方式为: 把知道的下载源都组织到一个文件中(metalink,扩展名 meta4),这些下载源可 …
脚本:
1 2 3 4 5 6 7 8 9 10 |
#!/bin/bash #name mssh.sh #usage: ./mssh.sh host-1 host-2 host-3 'cmd' cmd="${@: -1}" #取最后一个参数,这里冒号后面的空格不能省略 hosts=("$@") for ((i=0; i < $# - 1; i++)) ;do host=${hosts[$i]} echo "#@$host" echo ssh $host "$cmd" done |
用法: [crayon …
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# nsenter -h 用法: nsenter [options] <program> [<argument>...] Run a program with namespaces of other processes. 选项: -t, --target <pid> 要获取名字空间的目标进程 -m, --mount[=<file>] enter mount namespace -u, --uts[=<file>] enter UTS namespace (hostname etc) -i, --ipc[=<file>] enter System V IPC namespace -n, --net[=<file>] enter network namespace -p, --pid[=<file>] enter pid namespace -U, --user[=<file>] enter user namespace -S, --setuid <uid> set uid in entered namespace -G, --setgid <gid> set gid in entered namespace --preserve-credentials do not touch uids or gids -r, --root[=<dir>] set the root directory -w, --wd[=<dir>] set the working directory -F, --no-fork 执行 <程序> 前不 fork -Z, --follow-context set SELinux context according to --target PID -h, --help 显示此帮助并退出 -V, --version 输出版本信息并退出 更多信息请参阅 nsenter(1)。 |
从 help 来看,只要使用了 -p 选项, …