shell bash脚本_Shell脚本语言示例,Bash,Sh,Python,Powershell,MSDOS,PHP,Tcl,Perl...

shell bash脚本

shell bash脚本

A scripting language is a programming language supports writing simply to medium level applications in operating systems like Linux, Ubuntu, Debian, CentOS, Windows, MacOS, BSD, Unix. Scripting languages can be used to run complex tasks automatically or manually with very little effort. We can describe actions in a scripting language and run them easily. In this tutorial, we will look at popular scripting languages used by different operating systems and platforms.

脚本语言是一种编程语言,支持在Linux,Ubuntu,Debian,CentOS,Windows,MacOS,BSD,Unix等操作系统中仅向中等级别的应用程序编写代码。 脚本语言可用于自动或手动运行复杂的任务,而无需花费太多精力。 我们可以用脚本语言描述动作并轻松运行它们。 在本教程中,我们将研究不同操作系统和平台使用的流行脚本语言。

重击 (Bash)

Bash is the king of the scripting languages. bash provides very convenient programming features. Linux, Unix and BSD platforms fully support bash. If you want to learn more about bash look following the tutorial.

Bash是脚本语言之王。 bash提供了非常方便的编程功能。 Linux,Unix和BSD平台完全支持bash 。 如果您想了解有关bash的更多信息,请查看本教程。

Bash Tutorial

Bash教程

Following bash script will print Hello World to the standard output which is terminal in most cases.

以下bash脚本会将Hello World打印到标准输出(在大多数情况下为终端)。

#!/bin/bash

echo "Hello World"

(Sh)

sh is the limited version of the Bash . It provides basic features for the scripting environment. We can use sh in most of the daily operating like Bash . The following example will print Hello World to the terminal.

shBash的受限版本。 它提供了脚本环境的基本功能。 我们可以在大多数日常操作中使用sh ,例如Bash 。 下面的示例将Hello World打印到终端。

#!/bin/sh

echo "Hello World"

Python (Python)

Python is a popular programming and scripting language used in different platforms and applications. Python can be used to develop Desktop Applications, Web Applications, Scripts, Cloud Applications etc. There are a lot of ready to use Python scripts to be used in Linux, BSD, Unix, Windows, MacOS. Python provides a full feature set of programming languages. Python has two main versions numbered as 2 and 3.

Python是一种流行的编程和脚本语言,可用于不同的平台和应用程序。 Python可用于开发桌面应用程序,Web应用程序,脚本,云应用程序等。在Linux,BSD,Unix,Windows,MacOS中有许多现成的Python脚本可供使用。 Python提供了一套完整的编程语言功能。 Python有两个主要版本,分别为2和3。

Python Tutorials

Python教程

In this example we will print Hello World to the standard output.

在此示例中,我们将Hello World打印到标准输出。

#!/usr/bin/python3

print("Hello World")

微软DOS (MS-DOS)

MS-DOS is actually an operating system used 1980’s and 1990’s actively by Microsoft. But with GUI based operating system it’s used as an auxiliary tool for low-level operations like scripting and issuing commands. MS-DOS provides some programming features and structures. In this example, we will print Hello World to the MS-DOS command prompt.

MS-DOS实际上是Microsoft在1980年代和1990年代积极使用的操作系统。 但是在基于GUI的操作系统中,它用作脚本和发出命令之类的低级操作的辅助工具。 MS-DOS提供了一些编程功能和结构。 在此的示例中,我们将打印Hello World到MS-DOS命令提示符。

> echo "Hello World"

电源外壳 (PowerShell)

Powershell is the next generation programming and scripting language used by Windows operating systems. It has some basic support for Linux platform too. PowerShell has bindings with programming languages like C# and Visual Basic.Net. In this example, we will print Hello World to the screen.

Powershell是Windows操作系统使用的下一代编程和脚本语言。 它也对Linux平台提供一些基本支持。 PowerShell具有与C#和Visual Basic.Net等编程语言的绑定。 在此示例中,我们将在屏幕上打印Hello World

PS> Write-Output "Hello World"

Perl (Perl)

Perl is an old friend of Unix and Linux system administrators. As it is not so much popular currently there are popular applications developed with Perl. We can print Hello World to the terminal in a Perl script like below.

Perl是Unix和Linux系统管理员的老朋友。 由于目前还不太流行,因此有一些用Perl开发的流行应用程序。 我们可以使用下面的Perl脚本将Hello World打印到终端。

#!/usr/bin/perl
print "Hello World"

PHP (PHP)

PHP is a web-oriented programming language. PHP is designed as scripting language like Python. We can also use PHP as a system scripting language. We will print Hello World in this example.

PHP是一种面向Web的编程语言。 PHP被设计为像Python这样的脚本语言。 我们还可以将PHP用作系统脚本语言。 在此示例中,我们将打印Hello World

#!/usr/bin/php

echo "Hello World"
LEARN MORE  Linux Bash Pipe Command Usage with Examples For Redirection
了解更多Linux Bash Pipe命令用法以及重定向示例

翻译自: https://www.poftut.com/shell-scripting-languages-examples-bash-sh-python-powershell-msdos-php-tcl-perl/

shell bash脚本

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值