Execution of shell scripts with Echo yongming

Source: Internet
Author: User

Script execution

1. Give execution permission to run directly

chmod 755 hello.sh

./hello.sh #需要使用文件的绝对路径或相对路径

2. Execute script via bash call

Echo Output command

Syntax: Echo [-e] [output CONTENT]

-E: Character conversions that support backslash control

EG1: Output Hello world!

echo ' Hello world! '

Attention:

If you want to output an exclamation point, the output must be enclosed in single quotes

EG2: Use the-e parameter, escape character

#删除左侧字符, Output AC

Echo-e "AB\BC"

#制表符与换行符

Echo-e "A\TB\TC\ND\TE\TF"

EG3: Specify color, output content

#输出红色字符的abcd

Echo-e "\e[1;31m ABCD \e[0m"

30m= Black 31m= red 32m= green 33m= Yellow

34m= Blue 35m= Magenta 36m= cyan 37m= White

Execution of shell scripts with Echo yongming

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.