Shell script structure and execution methods

Source: Internet
Author: User
Tags create directory

[[email protected] ~]# mkdir shell[[email protected] ~]# cd shell/[[ email protected] shell]# vim first.sh#!/bin/bash                                 must be # #the  first test shell script.             Description # #written  by guozhen.mkdir 123                                    Create a 123ls                                           and displays the file under the LS directory echo  "this Is the first script. " 

How do you do it? Two methods

First Kind

[Email protected] shell]# Bash first.sh111 123 First.shthis is the first script.

The second Kind

[[email protected] shell]# chmod a+x first.sh plus permissions [[email protected] shell]#./first.shmkdir:cannot Create directory ' 123 ' : File exists111 123 First.shthis is the first script.

You can also use absolute paths

[Email protected] shell]#/root/shell/first.sh111 123 First.shthis is the first script.

can also be executed with SH

[Email protected] shell]# SH first.sh111 123 First.shthis is the first script.

To view the execution of a script (errors can be traced)

[[email protected] shell]# sh-x first.sh+ mkdir 123mkdir:cannot Create directory ' 123 ': File exists+ ls111 123 First.s H + echo ' This is the first script. ' This is the first script.








This article is from "Linux rookie" blog, please be sure to keep this source http://490617581.blog.51cto.com/11186315/1764394

Shell script structure and execution methods

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.