Shell script learning notes (1)-prerequisites

Source: Internet
Author: User

Prerequisites

Check script Syntax: Bash-V test. Sh Jack

Do not run. view onlyCode: Bash-n test. Sh

Trace execution: Bash-X test. Sh

Force variables to be declared first and then use: shopt-S-O nounset

When executing the script with SH test. Sh, you do not need to set the execution right of the script in advance.

The./CD. Sh sub-shell is closed immediately and then returned to the parent shell environment for execution.
Use. and source will allow the script to be executed only in the parent shell environment. This execution method will affect the parent shell environment, which is usually used in system calls. /root/tmp/CD. sh source/root/tmp/CD. sh

When Bash is called by SH file name, bash executes the Startup File in a way similar to the old version of SH, and will be as compatible with POSIX standard functions as much as possible, the bash-specific function will be lost

Bash -- POSIX, which becomes the POSIX mode. Bash uses features compatible with the POSIX standard.

./Test. Sh & Drop the task to the background for execution

TYPE command to view command type information

Alias display and settingProgramAlias

Executing multiple commands: C1; C2; C3 is not guaranteed to be successful. C1 & C2 & C3 is the previous successful command before executing the next command.

Script command

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.