Shell built-in commands and operating methods

Source: Internet
Author: User

1.!#/bin/bash

This is the first line of the shell script, and/bin/bash represents the location of the script's interpreter.

2. Run the script:

    (1) Bash test.sh

(2) Bash-x test.sh (ps:-x for observing script running state)

(3) Release script permissions: [1] chmod +x test.sh [2]./test.sh  

3. Shell's built-in commands (commands provided by Bash itself, not executable files):

  1. Type: Determine if a command is a built-in command (Ps:type CD)
  2. Alias: Create aliases for commands (Ps:alias ll= ' ls-l--color=tty ')
  3. Jobs: View paused tasks (pause with Ctrl + Z)
  4. BG 2: Put suspended task 2 in background run
  5. FG 2: Place background Task 2 in foreground run
  6. Declare-i num=1: Defines an integer num
  7. Declare-r num=1: Top one-only reading num
  8. Declare-a arr= ' ([0]= "a" [1]= "B" [2]= "C") '
  9. Declare-f: Displaying functions in a script
  10. Declare-f: Displays the function body in the script
  11. Export var=100: Import variables from the parent shell into the child shell (the child shell recognizes the variables defined in the parent shell)
  12. Let m=15%7: integer operations, support subtraction, i++,i--, and a series of integer algorithms
  13. PWD: Displays the current working path
  14. Read N: Reads a line from the standard input to the variable n (declare n read n)
  15. Ulimit: Display and set process resource scheduling (ulimit-a to show all process resources)

Shell built-in commands and operating methods

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.