Linux shell及shell脚本概念

 


在计算机科学中,Shell俗称壳(用来区别于核),是指“为使用者提供操作接口”的软件(命令解析器)。分为图形界面shell 和 命令行式shell。     “A shell is a program that acts as the interface between you and the Linux system, enabling you to enter commands for the operating system to execute.

Shell作为一种接口软件,有不同的实现,例如上图中的csh, bash都是shell。linux系统中可以同时安装不同的shell,用户可以根据自己的喜好来选择使用哪个。大多数的shell都是从而Bourne shell演化而来的。

On Linux, the standard shell that is always installed as /bin/sh is called bash (the GNU Bourne-Again SHell), from the GNU suite of tools. This is an excellent shell that is always installed on Linux systems, is open source, and is portable to almost all UNIX variants.

On most Linux distributions, the program /bin/sh, the default shell, is actually a link to the program /bin/bash. You can check the version of bash you have with the following command:
$ /bin/bash --version
GNU bash, version 3.2.9(1)-release (i686-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

 

When you create Linux users, you can set the shell that they will use, either when the user is created or afterwards by modifying their details. Figure 2-2 shows the selection of the shell for a user using Fedora.


各种shell总结:


同时它也可指一种程序设计语言。作为命令语言,它交互式解释和执行用户输入的命令或者自动地解释和执行预先设定好的一连串的命令;作为程序设计语言,它定义了各种变量和参数,并提供了许多在高级语言中才具有的控制结构,包括循环和分支。


Unix在最初的时候并没有图形操作界面,所有的命令都是通过命令行来输入的,linux继承了这种命令行的特性。shell在自动执行简单的linux任务方面可以发挥非常大的作用。

One reason to use the shell for programming is that you can program the shell quickly and simply. Moreover, a shell is always available even on the most basic Linux installation, so for simple prototyping you can find out if your idea works.

The shell is also ideal for any small utilities that perform some relatively simple task for which efficiency is less important than easy configuration, maintenance, and portability. You can use the shell to organize process control, so that commands run in a predetermined sequence dependent on the successful completion of each stage.

Although the shell has superficial similarities to the Windows command prompt, it’s much more powerful, capable of running reasonably complex programs in its own right. Not only can you execute commands and call Linux utilities, you can also write them. The shell executes shell programs, often referred to as scripts, which are interpreted at runtime. This generally makes debugging easier because you can easily execute single lines, and there’s no recompile time. However, this can make the shell unsuitable for timecritical or processor-intensive tasks.
 


Ref:

https://baike.baidu.com/item/shell/99702?fr=aladdin

《Beginning Linux Programming》,4th edition

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

First Snowflakes

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值