加载中
count a specific char in file

chenqi@pek-qchen1-d1:~/mypro/bash/count_specific_char$ ./count.sh c count.sh 10 chenqi@pek-qchen1-d1:~/mypro/bash/count_specific_char$ ./count.sh \" count.sh 4 #!/bin/bash coun...

Shell: days and dates

Code #!/bin/bash # given month, day and weekday, get the most recent year that match it usage() { echo "$(basename $0) weekday month day" echo "(example: $(basename $0)...

2012/10/29 18:49
26
一个简单文本处理问题的多种解法

问题: 将如下形式文本 Name: John Doe1 address : somewhere phone: 123-123-1234 Name: John Doe2 address : somewhere phone: 123-123-1233 Name: John Doe3 address : somewhere phon...

Bash: exec和文件描述符

echo 1234567890 > File # Write string to "File". exec 3<> File # Open "File" and assign fd 3 to it. read -n 4 <&3 # Read only 4 characters...

2012/09/26 17:49
143
Regular Expression

Basics Regular Expression 1) The $ and ^ ^XXX matches the beginning of a line XXX$ matches the end of a line 2) match any character with . 3) specify a range of characters with ...

2012/09/12 14:18
41
shell脚本解析 -- oe-init-build-env

oe-init-build-env #!/usr/sh if [ -z "$ZSH_NAME" ] && [ "x$0" = "x./oe-init-build-env" ]; then echo "Error: This script needs to be sourced. Please run as '. ./oe-init-build-e...

2012/08/05 14:48
2.5K
Bash, 双引号,单引号,感叹号

当要引用一个变量的值时,一般推荐使用双引号。使用双引号除了变量名[2]前缀($)、后引符(`)和转义符(\)外,会使shell不再解释引号中其它所有的特殊字符。[3] 用双引号时$仍被当成特殊字符,允...

2012/07/19 18:17
4.8K
diff and patch

root@test-desktop:/home/James/mypro/temp# more Makefile ALL: test child test: test.c gcc -Wall -o test test.c child: child.c gcc -Wall -o child child.c clean: -find ./ -name "te...

2012/07/17 17:41
89
Linux Shell学习(7)

1. 检查变量是否存在,如果不存在,则赋予默认值。 var=${NAME-default} e.g. #!/bin/bash argu=${*-noargu} edito...

2012/05/16 15:50
129
Linux Shell学习(6)

1. A yes/no dialog box dialog --common-options --yesno text height width e.g. dialog --title "Confirm Infomation" --yesno "Are you sure to continue?" 7 60 (我想到,利用Linux C...

2012/05/15 20:06
47
Linux Shell学习(5)

1. trap (用以捕捉信号) trap 'action' signal1 signal2 signalN ##set traps trap - signal1 signal2 signalN ##clear traps 2. 定义函数 e.g. root@localhost :/home/James/mypro/shell...

Linux Shell学习(4)

1. for loop for var in item1 item2 ... itemN do done for var in list-of-values do done for var in file1 file2 ... fileN do done for var in $filename do done for var in $(command...

2012/05/12 17:19
33
Linux Shell学习(3)

1. Path Name Expansion {pattern1,pattern2,..} 注意不能有空格。 e.g. root@localhost :~# echo file{1,2,3,5{6,7.8}}.txt file1.txt file2.txt file3.txt file56.txt file57.8.txt 2. 设置...

2012/05/11 16:35
32
Linux Shell 学习(2)

1. quoting shell会自动对通配符(wildcard)和变量(variable)做扩展,还会自动进行命令替换(command substitution),这个特性很方便;但是,有时我们并不想要这种扩展。 有三种方式可以控...

2012/05/10 18:24
58
Linux Shell 学习(1)

1. 查看系统上可用的shell cat /etc/shells 2. 得到目前使用的shell类型 echo $SHELL ps $$ ps -p $$ 3. 查看某个命令是否是是一个shell内部命令 type [-a] [command] 4. 显示shell command...

2012/05/09 17:55
79
Tool Command Language (Tcl)初体验

Tcl只有一种语法: command arg arg .... 这种设计真的是非常好,简洁,快速! 它和很多程序设计语言不一样,它没有关键词!譬如if, switch在Tcl中也是命令。 初次体验Tcl的感觉是:利用Tcl来...

2012/05/05 15:48
915
初试expect脚本

expect -c "set timeout 200" autorun.exp #! /usr/bin/expect spawn scp /home/James/release-gps/system.img root@10.0.0.28:/home/James/release-gps/system.img expect "password:" send...

2012/05/04 16:26
55

没有更多内容

加载失败,请刷新页面

没有更多内容

返回顶部
顶部