FAQ¶
2>&1¶
- 0:stdin
- 1:stdout
- 2:stderr
redirect stderr appending to stdout stream. &1是为了与文件1区别
这两者是不一样的。
tee¶
tee 命令支持从std IO读取并输出到文件。
ssh login without password¶
Copy local public key to remote machine.
Shell Parameter Expansion¶
\({param:-\)}¶
检查param是否为空,如果是,则使用备选的XXX
结果为
shell script set -xue¶
这些开关可以显式地写在脚本顶端,也可以在调用shell脚本时作为参数传入:
set -u检查是否有变量未定义undefined,如果有未定义,则终止脚本执行。 这个选项很有用,特别是当脚本里使用了rm -rf时可以避免意外的删除。
set -e脚本运行有错误error时,终止执行。相当于开启了断点。 不使用它的时候,shell默认会继续执行后续语句。
set -x展开eXpand显示变量的内容
Using Docker with Rootless Mode¶
1.Add docker group to system (if non-existed)
2.Adding user uec1szh to group docker
3.change group or logout to change to the new group
NOTE:
For lower version ubuntu (< 21.04), still need to change socker file attribute.
4.(Optional) logout
logout via remote ssh¶
Cannot change default shell - user 'xxx' does not exist in /etc/passwd¶
The system is using distributed authentication (Kerberos), so user account doesn't appear in local /etc/passwd.
However user account can be retrieved via:
output: