Chinaunix首页 | 论坛 | 博客
  • 博客访问: 146183
  • 博文数量: 28
  • 博客积分: 1646
  • 博客等级: 上尉
  • 技术积分: 405
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-12 14:28
文章分类

全部博文(28)

文章存档

2013年(28)

我的朋友

分类: LINUX

2013-03-13 15:17:36

2. Scripting and the Shell
2.1 Shell Basics
Command editing
Pipes and redirection
STDIN(0), STDOUT(1), STDERR(2)
<, >, >>
Pipe: |
&&, || (short circuit evaluation)
Variables and quoting
Common filter commands
cut, sort, uniq, wc, tee, head, tail, grep
2.2 Bash Scripting
comments start with a hash mark(#)
From commands to scripts
Input and output
echo, printf, read
Command-line arguments and functions
$0: script name
$1, $2,...: arguments
$#: number of command-line arguments/ function arguments
$*: all arguments
$?: exit status of the last command executed
Variable scope
default is global, function can define local variable with "local"
Control flow
if [$variable -eq 1]; then
statements
elif []; then
statements
else
statements
fi
case $v in
0) s1;;
1) s2;;
*) s3
esac
Loops
for v in *.sh; do
statements
done
for ((i=0; i<$n; i++)); do
statements
done
while read line; do
echo "$line"
done
Arrays and arithmetic
2.3 Regular Expressions
The matching process
Literal characters
Special characters
Example regular expressions
Captures
Greediness, laziness, and catastrophic backtracking
2.4 Perl Programming
Variables and arrays
scalars($), arrays(@), hashes(%)
Array and string literals
Function calls
Type conversions in expressions
String expansions and disambiguation of variable references
Hashes
References and autovivification
Regular expressions in Perl
Input and output
Control flow
Accepting and validating input
Perl as a filter
Add-on modules for perl
2.5 Python scripting
Python quick start
Objects, strings, numbers, lists, dictionaries, tuples, and files
Input validation example
Loops
2.6 Scripting best practices
2.7 Recommented reading
2.8 Exercises
阅读(1288) | 评论(0) | 转发(0) |
0

上一篇:冒泡排序

下一篇:3. Booting and Shutting Down

给主人留下些什么吧!~~