Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the knowledge of shell?

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article is to share with you what are the knowledge points about shell, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Cloud Computing Learning Route course outline Courseware about shell knowledge points:

In shell grammar, there is a frame for printing color fonts, which is often used to output error reports or information that needs to be displayed specially. This operation is very practical, such as I

When writing an operation and maintenance tool, you can greatly enhance the visibility of the program.

Get and set the date

Usually when we write a script, we want to record this execution after the execution of the script and write it to a log file so that we can track each

The result of the second execution is also convenient for us to analyze the number of calls to the script.

Basic methods of debugging scripts

[root@bavdu shell_s] # vim color_daemon01.sh

#! / usr/bin/env bash

# Font color code: reset = 0 black = 30 red = 31 green = 32 H color = 33 blue = 34 magenta = 35 cyan = 36 white = 37

# background color code: reset = 0 black = 40 red = 41 green = 42 H color = 43 blue = 44 magenta = 45 cyan = 46 white = 47

Export green= "this is a green."

Printf "\ e [1th 31m $green\ e [0m\ n"

[root@bavdu shell_s] # sh color_daemon01.sh

This is a green. This is red

[root@bavdu shell_s] # vim date_daemon01.sh

#! / usr/bin/env bash

#

Printf "Hello world"

Echo date +% Y-%m-%d_%k:%M:%S > > / var/log/date_daemon01.log

[root@bavdu shell_s] # cat / var/log/date_daemon01.log

2018 / 12 / 27 _ 6:34:45

[root@bavdu shell_s] # vim date_daemon01.sh

#! / usr/bin/env bash

#

Printf "Hello world" # deliberately omitted a letter

Echo date +% Y-%m-%d_%k:%M:%S > > / var/log/date_daemon01.log

[root@bavdu shell_s] # bash-x date_daemon01.sh

Rintf 'Hello world'

Date_daemon05.sh: line 8: rintf: command not found

+ + date +% Y-%m-%d_%k:%M:%S

Echo 2018-12-27 _ 6:38:14

[root@bavdu shell_s] #

What are the above knowledge points of shell? the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report