shell----

just posted @ 2009年3月20日 07:31 in linux , 1108 阅读

1 最简单的shell脚本:

vi   first.sh

在里面输入 

ls  -l

保存退出

最简单的脚本  现在它没有执行权限

要执行 chmod a+x first.sh  付给它执行权限

然后  ./first.sh  即可执行

 

2------------------------

下面继续修改  接受输入

first.sh:

#接受输入 然后再输出 
echo   "please enter your name:"

read  fname

echo $fname

保存退出。

运行 ./first.sh

-------------------------------------------

 3 继续

#接受输入 然后再输出 
echo   "please enter your name:"

read  fname

echo $fname

s=xxx
echo $s

echo  `date`

 date命令用反引号,就是esc下面的那个键

5

expr  4 + 5   #注意  4    +    5  之间有空格

输出 9

expr      4+5   #  没有空格

输出   4+5

-----

echo   $((4+5))

输出  9

 6---------------

read score   #读入分数

if    [$score -lt   80 ]   #如果小于80

 then

      echo   "wrong !!!"

elif   [ $score -ge  80  -a   $score  -lt   9 ]   #  大于等于80  小于90

 then   

          echo   "good  "

else

         echo  "very good"

 fi
 
  • 无匹配
  • 无匹配
CBSE 9th Class Books 说:
2022年9月10日 17:45

Central Board of Secondary Education (CBSE) Start 9th Class School Month of Jun 2023, Students Study CBSE 9th Class Books in Summer Holidays for Better Education Skills Improvement Curriculum for the Academic Year 2023, CBSE 9th Class Books There are Many books in the Market but “CBSE Books” Stand alone in the market. Candidates Preparing for 9th Examinations as well as CBSE Aspirants Require Good Textbooks and resources for High Level Preparation.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter