Linux Shell Scripting Raiders Review

Source: Internet
Author: User
Tags echo command

1. After opening the terminal prompt, $ represents a normal user, #表示管理员用户root, root is the most privileged user in the Linux system.

2. A shell script is usually a text file with a #! start, where #! precedes the interpreter path. Example: #!/bin/bash

3. Note section starts with #, and consistently continues to the end of the line

4. By default, Echo adds a line break after each call. The text after echo can be enclosed in double quotation marks, with single quotation marks, or without single and double quotation marks.

Note: When using the unquoted echo, you cannot use a semicolon (;) in the text that you want to display, because the semicolon is used as a command delimiter in bash.

B. Variable substitution is not valid in single quotation marks, and single quotation marks print out text as is.

5. printf uses a formatted string, you can specify the width of the string, left-right alignment, and so on. By default, printf does not automatically add line breaks like the echo command.

For example: printf "%-5s%-10s%-4s\n" No name mark result No name Mark

printf "%-5s%-10s%-4.2f\n" 3 Jim 77.564 results for 3 Jim 77.56

%-5s indicates a string substitution with a left-aligned format and a width of 5

    

Linux Shell Scripting Raiders Review

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.