Shell script 初探

来源:互联网 发布:ubuntu下载安装jdk1.7 编辑:程序博客网 时间:2024/05/20 15:10

1. #!/bin/sh 

2.# as comment

3.echo as print  

4.variable neednt statement,directly use ,like   a = '123'   echo  $a

5.the special print  :  echo ${a}bc   ----the result is  123bc .    echo $abc   will print  null.....  because   cant find variable abc.

6.awk use for abstract field from txt file .  -F as its option 

7.管道、重定向&backtick

8.example:

#!/bin/sh

echo "what os is you favorite?"

select var in "linux" "ubuntu "  "windows" "mac os" "others" ;

do

break

done

echo "you have selected ${var}os"


/////有的可能会出错,将sh 改为bash ,执行脚本命令改为bash or ./yourfilename.



9.export 命令

复制功能,或者说转换作用域。

10.shell python :  以空格作为代码块控制。

11.shell中变量设置有多种不同模式。http://www.uuxiao.com/diary_show.asp?id=530

12.http://www.tutorialspoint.com/unix/unix-special-variables.htm

link:http://linux.chinaunix.net/doc/system/2005-02-03/1083.shtml


link:http://blog.chinaunix.net/uid-9078183-id-2436460.html

原创粉丝点击