Linux Shell Learning Note 00

Source: Internet
Author: User
Tags shebang

1. Bash = Bourne Again SHell

2. Terminal prompt:

#普通用户 [email protected]$ #管理员用户 [email protected]#

3. The shell script is usually a text file that starts with Shebang:

#! /bin/bash

Shebang is a line of text where #! is before the interpreter path. /bin/bash is the command path of the BASH interpreter.

In Unix jargon, the character "#" is usually read as "sharp" or "hash" or "mesh" to address the exclamation point "!" Called Bang, "shebang" means that the two words match up "#! ”。

4. Write the string to text:

echo "This is a sample text!" > Temp.txt

Insert a string after the text:

echo "This is another sample text!" >> temp.txt

To view the contents of a text file:

Cat Temp.txt

REDIRECT error message stderr to text:

$ ls + 2> OUT.txt

LS + is an error statement, "2>" is a stderr redirect.

/dev/null is a special device file, and any data it receives will be discarded and called a device black hole. Data is gone.

5. Generate the delay in the script:

#! /bin/bashecho-n count:tput sccount=0;while true;do    If [$count-lt];    then let        count++;        Sleep 1;        Tput RC        tput ed        echo-n $count;    else exit 0;    Fidone

Linux Shell Learning Note 00

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.