日期:2014-05-16  浏览次数:20621 次

linux 之shell 2

1.初认识shell

echo –e 处理特殊字符

以下省略注释

?

#!/bin/bash

#program:

#?????? this program shows "hello world" in your screen

#histroy:

#2012/10/8 labreeze first-release

?

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin

export PATH

echo -e? "hello world\a\n"

exit ?0

2.定义变量 输出变量

#!/bin/bash

?

#var

var1="apple"

var2=orange

?

echo ${var1},$var1

echo "${var1},$var1"

?

echo ${var2},$var2

echo "${var2},$var2"

?

#array

users=(one two three)

#len=${#users[*]}

len=${#users}

echo $len

exit 0

?

?

?

3.终端读取变量

read –p

-p 标志的文件结束符引起该进程的清除,因此产生另外一个进程。

?