首页 > 系统服务 > 详细

Shell(BASH) 编程

时间:2015-05-10 12:44:26      阅读:372      评论:0      收藏:0      [点我收藏+]

SHELL PROGRAMMING

 

目录:

1.shell简单介绍

2.shell 编程准备

3.shell编程结构化语言构建

4.其他

5.shell编程的两个示例

技术分享

写在前面:

1.Hello World

#!/bin/bash
# This is an example of bash HelloWorld
# You can start shell programming with an Hello World example
echo Hello World

 

2.计算1+1=2

#!/bin/bash
#
# This example will bring you to bash shell more deeply.
# Function: add two input numbers and then print the result.

if [ $# -ne 2 ]                                # error handling
then
    echo "Usage - $0   x    y"                 # display help message 
    echo "        Where x and y are two nos for which I will print sum"
    exit 1
fi
    echo "Sum of $1 and $2 is `expr $1 + $2`"

 

 

正文:

 

1.shell简单介绍

  我们都知道,计算机识别的是二进制语言,计算机指令也是用二进制来表示的,但这对我们来说却相当困难。所以在一些操作系统中就有一个特殊程序叫做shell, shell接受你输入的指令,并且如果它是正确的话,就会将该指令传递到内核。

  shell是一个用户程序或者说是一种由计算机与用户交互的环境。shell是一种解释型语言,可以执行来自标准输入设备(键盘)或者是文件的命令。 Linux shell跟windows command 类似,但是前者功能更为强大。

 

 

2.shell 编程准备

 

3.shell编程结构化语言构建

 

4.其他

 

5.shell编程的两个示例

 

 技术分享

 

Shell(BASH) 编程

原文:http://www.cnblogs.com/7explore-share/p/4491996.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!