Without other narrates, this note is only intended for Debian or Ubuntu.
command | function | usage |
---|---|---|
update-alternatives | multi-version runnable program preference management | |
test -x ${file} | test if ${file} exists and granted with executable permission | |
if [ -f ${file} ] | test if this file is a regular file | |
set -e | cause the shell to exit if any subcommand or pipeline returns a non-zero status |
-
Column editing mode
- Ctrl+v enter Block Visual Mode
- Shift+i to insert
- enter some chars
- double press Esc to make it take effect
-
disable auto visual mode
when using vim, selecting some text with the mouse automatically enter visual mode. I rarely use the visual feature and when I use it I prefer using the v keyboard command. There must be a way to disable this "stupid" setting.
- issue the command :set mouse-=a
- insert the directive set mouse-=a into your ~/.vimrc file
-
: set number
- Definition of function
function function_name {
}
or
function_name () {
}
- $$|$?|$@|$#
- $? contains the return status of the previously run command or function.
- $# number of parameters
- [Add items to Xfce Applications Menu](http://xubuntugeek.blogspot.com/2011/12/add-items-to-xfce-applications-menu.html)
实例:
- display参数列出一个命令的所有可选命令
# update-alternatives --display java
- config参数用于给某个命令选择一个link值,相当于在可用值之中进行切换吧。
# update-alternatives --config java //有 3 个候选项可用于替换 java (提供 /usr/bin/java)
选择 路径 优先级 状态
------------------------------------------------------------
0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 自动模式
* 1 /home/wuekzhu/download/jdk1.6.0_23/bin/java 1 手动模式
2 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 手动模式
- install参数用于添加一个命令的link值,相当于添加一个可用值,其中slave非常有用。
# update-alternatives –-install /usr/bin/java java /usr/local/jre1.6.0_20/bin/javac 100
# update-alternatives –-install /usr/bin/java java /usr/local/jre1.6.0_20/bin/javac 100 –slave /usr/bin/javac javac /usr/local/jre1.6.0_20/bin/javac
- remove参数用于删除一个命令的link值,其附带的slave也将一起删除。
# update-alternatives –remove java /usr/local/jre1.6.0_20/bin/java
update-alternative有两种模式:auto和manual,默认都为auto模式,因为大多数情况下update-alternatives命令都被postinst (configure) or prerm (install)调用的,如果将其更改成手动的话安装脚本将不会更新它了。
若是想将manual改回自动模式的话,执行命令: update-alternatives --auto name即可,如 update-alternatives --config java
Be careful of using set -e in init.d scripts. Writing correct init.d scripts requires accepting various error exit statuses when daemons are already running or already stopped without aborting the init.d script, and common init.d function libraries are not safe to call with set -e in effect. For init.d scripts, it's often easier to not use set -e and instead check the result of each command separately.