• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Shell编程学习


wings

Recommended Posts

1、Shell编程介绍
Linux体系中的shell编程在实现系统管理与维护、系统使用、用户环境定制等方面作用突出。

使用shell写的程序通常也称为脚本。

在用户主目录中,在/etc目录中,随处可见脚本文件。

脚本是由各种变量、表达式、命令等通过一定的逻辑组装而成的,具有顺序解释执行的特性。

2、Shell脚本基本结构
#!/bin/bash        #脚本必须以#!开始
#! 表示:/bin/bash将执行该脚本文件中的程序
#    表示此后的字符串为注释

脚本支持:变量、表达式、流程控制、函数、注释,各种外部命令和程序调用、命令行参数、系统变量等等。

脚本就是将上述各种元素通过一定的逻辑关系进行组装已完成特定任务的程序。

3、Shell脚本及运行
1、利用vi编辑如下脚本并保持成 first.sh

#!/bin/bash
echo "Hello,welcome to Linux world"
echo "Today is $(date)"

2、设置执行权限

chmod u+x first.sh

3、执行脚本

./first.sh 或 sh first.sh 或 bash first.sh
————————————————
版权声明:本文为CSDN博主「拒绝刘亦菲」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_42250189/article/details/105743561

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now