Linux exit command Learning

Source: Internet
Author: User
Tags exit in

The exitshell exit code has two functions: 1. exit the current shellsh-# exitexitINIT: Entering runlevel: 3 2. directly exit in shell script, so that we can use a specific exit code to indicate the execution status of scripts when writing shell scripts. Sh-# touch/test_exit.shsh-# cat/test_exit.sh #! /Bin/shexit 127 sh-# ls-l/test_exit.sh-rwxr-xr-x 1 root 24 Jan 1/test_exit.shsh-# $? Sh: 0: command not foundsh-#/test_exit.shsh-# $? Sh: 127: command not foundsh-# echo "exit 126">/test_exit.shsh-# cat/test_exit.shexit 126sh-#/test_exit.shsh-# $? Sh: 126: command not foundsh-# vimsh: vim: command not foundsh-# $? Sh: 127: command not found: usually 0, indicating that the command is successfully executed. A value other than 0 indicates that the command fails to be executed.

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.