Linux vi/vim
所有的 Unix Like 系统都会内建 vi 文书编辑器,其他的文书编辑器则不一定会存在。
但是目前我们使用比较多的是 vim 编辑器。
vim 具有程序编辑的能力,可以主动的以字体颜色辨别语法的正确性,方便程序设计。
相关文章:史上最全Vim快捷键键位图 — 入门到进阶
什么是 vim?
Vim是从 vi 发展出来的一个文本编辑器。代码补完、编译及错误跳转等方便编程的功能特别丰富,在程序员中被广泛使用。
简单的来说, vi 是老式的字处理器,不过功能已经很齐全了,但是还是有可以进步的地方。 vim 则可以说是程序开发者的一项很好用的工具。
连 vim 的官方网站 (http://www.vim.org) 自己也说 vim 是一… Read More
做一个文本文件做测试:
Given below is content of file called test. Absolute path is /tmp/test
This is a test
for sed command
to be performed
on test server
Hello World
How do you do
本教程使用两种模式:We are using two methods in this tutorial
模式一: 使用‘d’ 删除 ,Method 1 : By using ‘d’ command i.e for delete
模式二: 使用‘p’ 打印, Method 2 : By using ‘p’ command i.e for print
SED… Read More
直接代码:
bash -x test.sh 2>&1 | tee out.test
或者:
bash -x script.sh 2> log
-x表示debug模式
本文:Shell: debug所有运行过程到log文件, Run a bash script in debug mode, show output and save it on a file… Read More
shell函数不能直接返回字符串,用以下三种方式代替!
A Bash function can’t return a string directly like you want it to. You can do three things:
Echo a string
Return an exit status, which is a number, not a string
Share a variable
This is also true for some other shells.
Here’s how to do each of those options:
1. Echo strings
lockdir="somedir"
testlock(){
retva… Read