庆典VS CSH VS别人 - 这是应用维护好? [英] bash vs csh vs others - which is better for application maintenance?

查看:139
本文介绍了庆典VS CSH VS别人 - 这是应用维护好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
   Linux的shell我应该使用什么?

我开始获得在Linux环境中熟练和我试图挑选择的武器,命令shell脚本方面(如我仍然在这一个大的n00b),这将帮助我(和其他人)管理,测试和管理上的* NIX环境中运行一组服务器端应用程序。

I am starting to get proficient in a Linux environment and i'm trying to pick a weapon of choice in terms of command shell scripting (as i'm still a big n00b at this) that will help me (and others) manage, test and administer a set of server side applications running on a *NIX environment.

我的问题是:什么是(有)的preferred命令shell(S)在那里当以下条件被认为是:

My question is: What is(are) the preferred command shell(s) out there when the following criteria are considered:


  1. 是多么容易学会/理解初级开发谁从未有过的接触shell脚本?

  1. How easy is it to learn/understand for a junior dev who has never had an exposure to shell scripting?

是否有开发商在那里,知道这个shell脚本一个大池?

Is there a big pool of developers out there that know this shell script?

它是安全和易于使用 - 将脚本错误是沉默还是给智能错误输出,将它让脚下的门外汉拍摄他们的自我

Is it safe and easy to use - will script errors be silent or give intelligent error output, will it let the uninitiated shoot them selves in the foot?

便携性如何呢? - 我可以期待同样的脚本在运行的OpenSolaris以及红帽,FreeBSD的? (授予命令语法和特定的操作系统的选项会相应变化)

How portable is it? - Can i expect the same script to run in OpenSolaris as well as Redhat, FreeBSD? (granted command syntax and options for specific OS will change accordingly)

如何标准是什么呢?它是预计将包括在* NIX大多数发行版的还是它必须额外安装?

How standard is it? Is it expected to be included on most distro's of *NIX or does it have to be installed additionally?

据我所知,有阵营在那里谁持有强烈的感情赞成/反对特定的命令shell,我只是寻找一个知情的意见。

I understand that there are camps out there who hold strong feelings for/against specific command shells, i am just looking for an informed opinion.

推荐答案

这些天来,几乎所有的非嵌入式(或大嵌入式)操作系统具有的 POSIX:2001又名单一Unix V3 的兼容层。这是本地UNIX平台(在Linux,Mac OS X,Solaris和* BSD等),并安装在其他平台,如Windows和Android。 POSIX指定外壳的语言,通常称为POSIX SH。这种语言是从Bourne shell中的。

These days, just about any non-embedded (or large embedded) operating system has a POSIX:2001 a.k.a. Single Unix v3 compatibility layer. This is native on unix platforms (Linux, Mac OS X, Solaris, *BSD, etc.) and installable on other platforms such as Windows and Android. POSIX specifies a shell language, usually known as POSIX sh. This language is derived from the Bourne shell.

大多数Unix系统有POSIX SH的两个实现之一:KSH或bash,相比POSIX具有更多实用的功能。然而,一些非主流的系统(特别是嵌入式的)可能只有POSIX规定的功能。

Most unix systems have one of two implementations of POSIX sh: ksh or bash, which have additional useful features compared to POSIX. However some less mainstream systems (especially embedded ones) may have only POSIX-mandated features.

鉴于你的目标,我看到三个选项:

Given your objectives, I see three choices:


  • 限制自己POSIX sh的。优点:你不必担心不同的变种,因为有一个标准,兼容实现都一应俱全。缺点:你不从的bash和ksh的扩展受益

  • 使用KSH和bash的交集。这是在外观上吸引人,但它确实意味着你必须使用两个参考文件,而不是只有一个 - 甚至是bash和ksh的共同点并不总是使用相同的语法特点。弄清楚你想要一个给定的系统上使用哪一种也是一种痛苦。

  • 选择KSH或bash之一。无论bash和ksh的是适用于所有的类Unix平台和Windows操作系统。两者都有一个开源实现,可在大多数平台上进行安装(唯一一个对于bash,ksh93的ATT为KSH)。我会去的bash ksh的多,原因有二。首先,它是在Linux的默认,所以你会发现已经习惯了谁更多的人。其次,有来有旧的,功能较少的实现KSH系统;即使你可以安装ksh93的,这是有关部署时,你要想到另外一件事情。

忘记CSH的脚本,而忘记了zsh的,如果你想共同默认的可用性。

Forget about csh for scripting, and forget about zsh if you want common default availability.

另请参阅什么是主流之间的根本区别* NIX弹?,特别是执行脚本部分<一个href=\"http://unix.stackexchange.com/questions/3320/what-are-the-fundamental-differences-between-the-mainstream-nix-shells/3390#3390\">my回答。

See also What are the fundamental differences between the mainstream *NIX shells?, particularly the "for scripting" part of my answer.

注意,shell编程涉及超过壳其他实用程序。 POSIX指定其他实用程序。 击加上其他POSIX实用工具是一个合理的选择,有别于POSIX设施(包括SH)。

Note that shell programming involves other utilities beyond the shell. POSIX specifies those other utilities. "Bash plus other POSIX utilities" is a reasonable choice, distinct from "POSIX utilities (including sh)".

这篇关于庆典VS CSH VS别人 - 这是应用维护好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆