
shell
文章平均质量分 59
timidsmile
我若不坚强,软弱给谁看????
展开
-
一些shell的小命令~
这里采用bash进行shell编程。因为bash是免费的,并且方便使用。bash - bourne again shell 文件命名为 myshell.sh 执行文件前,先获得权限: chomod 777 myshell.sh 1.显示文件内容 #!/bin/bash cat myshell.sh 执行命令: ./myshell.sh 显示结果:原创 2012-07-02 17:50:56 · 1065 阅读 · 0 评论 -
shell----- 条件选择 if && case
1 if #!/bin/bash echo "Please chose your favourite fruit:"; select fruit in "apple" "orange" "banana" "none"; do break; done; if [ $fruit == "apple" ] then echo "you like apple!" elif [ $fru原创 2012-07-02 18:28:07 · 2376 阅读 · 0 评论 -
shell------ I/O 重定向
<!-- @page {margin:2cm} h3 {margin-top:0.46cm; margin-bottom:0.46cm; line-height:173%; page-break-inside:avoid} h3.western {font-family:"Times New Roman",serif; font-size:16pt} h3.cj原创 2012-07-03 10:05:15 · 802 阅读 · 0 评论 -
shell-------------数组
先看一个例子: #!/bin/bash area2=(zero one two three four) echo "Origin is :" echo ${area2[0]} ${area2[1]} ${area2[2]} ${area2[3]} ${area2[4]} area2[1]=1 area2[4]=4 echo "After is :" echo ${area2[0]} $原创 2012-07-03 14:26:10 · 2121 阅读 · 0 评论 -
shell ----- 循环 for && while && util
1 for loops <!-- @page {margin:2cm} p {margin-bottom:0.21cm} --> 结构: for arg in [list] do command(s)... done #!/bin/bash sum=0 for INT in 1 2 3 4 5 do sum=`expr $sum + $INT`原创 2012-07-03 09:47:46 · 2852 阅读 · 0 评论 -
shell---函数
一个例子: #!/bin/bash One() { echo "You like $num" } Two() { echo "You like $num" } Three() { echo "You like $num" } echo "the usage of function : " select num in "one" "two" "three" do原创 2012-07-03 16:22:15 · 692 阅读 · 4 评论 -
shell 字符串数组的使用
ex 简单例子: str=("h_ee" "h__i" "h_ed0llo") for s in ${str[@]}; do echo "$s" done原创 2014-07-03 13:04:06 · 17816 阅读 · 0 评论