Compiling the next batch processing file in Linux

Source: Internet
Author: User
(1) in Linux, the batch processing file is basically a shell script file. 1. the simplest way to write a script is to create a new file named "clean" and write Rm-FV * in it *. o; LS-Al; (you can write some common shell commands, which are separated by semicolons) 2. execution Method

(1) Enter:

Sh clean

(2) grant the script executable permission: chmod 777 clean and then directly execute:./clean to add other functions one after another .... (2) in Linux, the batch processing file is basically a shell script file.
The simplest script writing method is:
1. Create a new file named test)
Nano test. Sh
2. write scripts in it
The program must start with the following line (must begin with the first line of the file ):
#! /Bin/sh
Symbol #! The parameter used to tell the system that the program is used to execute the file. In this example, we use/bin/sh to execute the program.
(You can write some common shell commands separated by semicolons)
Example:
#! /Bin/bash
# Shutdown PC
Sudo shutdown + 1

3. Execution Method
(1) run the following command on the console:
Sh test. Sh

(2) give the script executable permission first, and double-click to execute:
Right-click the file and choose "properties"> "Permissions". At the bottom of the page, you can select "Allow File Execution by program.
Or attach the following permissions to the command line:
Chmod 777 test. Sh
Or: chmod + X test. Sh

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.