Shell exit, return summary, shell exit summary

Source: Internet
Author: User

Shell exit, return summary, shell exit summary

Common Responses in shell: exit, breakm, return

Exit:

In fact, after each command is executed, an execution state is returned!

If the execution is successful, 0 is returned.

If the execution limit is not exceeded, a non-zero value is returned!

Example application: Used in shell scripts to make true and false judgments,

If the previous statement is OK, shell then executes the next command;

If the preceding error occurs and the returned value is non-zero, exit shell directly;

Break:

It can only be used in shell internal loops, such as if... then... else... fi.

Return:

This function is very useful and returns values from the function.

Echo:

Execute echo "xxx" and the executable output value

Execute echo "$ xxx" to output variable values

Link: shell exit and exit

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.