简体   繁体   English

linux上的脚本外壳和solaris上的脚本外壳之间的区别

[英]difference between script shell on linux and script shell on solaris

I want to learn shell scripting and I will use solaris in my work. 我想学习shell脚本,我将在工作中使用solaris。 Is there any difference between shell scripts on linux and shell scripts on solaris? linux上的shell脚本和solaris上的shell脚本之间有什么区别吗?

The difference is not between Linux and Solaris, the difference is between which shell you are using on each: sh, csh, ksh, zsh, bash etc. 区别不在于Linux和Solaris之间,区别在于您在每个shell上使用的外壳:sh,csh,ksh,zsh,bash等。

When you write a shell script you should always start it with a shebang indicating what shell the script is written for. 编写shell脚本时,应始终以shebang开头,以指示该脚本针对的shell。 For example 例如
#!/bin/bash
or 要么
#!/bin/csh

Note shebang also works for scripting in non-shell languages: 注意shebang还可以使用非外壳语言编写脚本:
#!/usr/bin/perl
#!/usr/bin/python

The bash shell is now commonly available nearly everywhere, and I suggest that's the one you learn if it's available on you Solaris system. bash shell现在几乎在任何地方都可以使用,如果它在Solaris系统上可用,我建议您从中学习。
/bin/sh is the POSIX shell and you should learn that, and the differences between it and bash. /bin/shPOSIX shell,您应该了解它以及它与bash之间的区别。

ksh is an improvement over sh , as is zsh (but zsh claims it "is a shell designed for interactive use" ) kshzsh一样,是对sh的改进(但zsh声称它“是为交互使用而设计的外壳” ))

csh is considered evil csh认为是 邪恶的

These days bash and sh are the ones to learn. 如今, bashsh是需要学习的东西。

thank you all. 谢谢你们。 What I understood from your replies that I have to learn the bash shell which is compatible with linux and solaris. 从您的答复中我了解到,我必须学习与Linux和solaris兼容的bash shell。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM