Usage of shell internal commands

Source: Internet
Author: User


Shell Internal commands:


1: exec command

If the common commands such as ls, cat, and less are executed in the current Shell, the Shell process ends after the exec command is executed. Therefore, we generally put the command into the script for execution. After the command is executed, SubShell automatically ends and returns to the main Shell.

In special cases, if the exec command is followed by a file descriptor redirection, the current Shell process is not terminated and the command following the exec command is still executed, for example: exec 1> test echo "hello world": Execute exec 1> text and then execute echo "hello word" in the current shell ".

2: set and unset commands

Set var: sets var as a shell script parameter.

Unset var indicates to delete or uninstall the var variable from the script.

3: test or [command

Test expression indicates whether expression is true. true is returned if expression is true.

[-F file] [the command works the same as test.

4: export command

Export var sets the variable as a global variable.


5: Colon command

: The command is the same as the true command, with no specific meaning


6:. Command

../Shell_script indicates to execute shell_script in the Current shell


$ (Cat file) indicates to execute the command in parentheses and obtain the output result.

'Cat file' same as above



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.