Shell Scripting Learning

Source: Internet
Author: User

1.Shell command line writing rules:

Multiple commands can be executed on a command line, but required;

Long command statements can be expanded with \ on the command line

2. Execute Shell Program

2.1./test.sh

2.2 Bash test.sh

2.3 In order to compile and execute the shell-written program in any directory, add the/bin directory to the entire environment variable

Export Path=/bin: $PATH

test.sh

3. Parameters used in shell programs

3.1 Position parameters

The parameters provided by the system are called positional parameters, and the values of positional parameters can be obtained by $n, and Linux will fragment the input command string and label each segment, starting from 0. Number No. 0 indicates the program name, starting with 1, indicating the parameters passed to the program, and so on.

3.2 Internal parameters

$: command contains the path of the command

$#: The total number of arguments passed to the program

When the $?:shell program exits in the shell, the normal exit returns 0, whereas a non-0 value is returned.

$*: A string that consists of all the arguments passed to the program

Shell Scripting Learning

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.