In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I would like to talk to you about how to understand shell-0, many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something from this article.
Shell-0. Introduction
1. Shell scripts are used in those environments.
Application environment: multiple complex parameters are required to execute some commands
Multiple commands are needed to view and maintain the status of the system
Back up the database regularly
Monitor important processes and logs of the system according to specific conditions
Conduct weekly inspection of major systems
Analyze the security of the configuration files of important network equipment, and give the corresponding analysis report.
Detect the equipment in the network, collect relevant asset information, and enter the asset information table
For example:
Through the command: check the syntax and parameters carefully every time
Write detailed system maintenance documents, list the commands to be maintained, and the administrator operates according to the system maintenance documents.
Backup the database at 6: 00 p. M. every day
Perform monitoring, command, or view the system screen every 10 or 15 minutes
The workload is heavy and the data is difficult to organize.
two。 What is Shell?
Shell---- kernel-hardware
Please check
Http://yuanji6699.blog.51cto.com/11568362/1771930
Constituent elements of a 3.Shell script
Notes
System command
Text processing tool (sort,grep,sed,awk...)
Variabl
Conditional judgment
Cyclic structure
Function.
4. Check which shell is supported by the system
Debian:/myshell# cat / etc/shells
# / etc/shells: valid login shells
/ bin/csh
/ bin/sh
/ usr/bin/es
/ usr/bin/ksh
/ bin/ksh
/ usr/bin/rc
/ usr/bin/tcsh
/ bin/tcsh
/ usr/bin/esh
/ bin/bash
/ bin/rbash
So many, basically using bash
5. View the sh type used by the current user
Debian:/myshell# echo $SHELL [Note this may not be correct]
/ bin/bash
You should use [be sure to check before use, individual system versions are not bash by default]
Ls-alh / bin/sh
Root@WebB:/home/log# ls-lah / bin/sh
Lrwxrwxrwx 1 root root 4 Nov 14 15:15 / bin/sh-> dash [actually using dash]
Root@WebB:/home/log# echo $SHELL
/ bin/bash
Solution:
-
So how do you change sh to point to bash?
The most violent way, of course, is to directly change the soft link of / bin/sh to bash.
Such as: ln-s / bin/bash / bin/sh
Check again, ls / bin/sh-al finds that the soft link points to / bin/bash.
-
6. First script (International practice, hello world)
Debian:/# vim first.sh
#! / bin/sh
Echo "Hello world"
Debian:/# sh first.sh
Hello world
Debian:/# chmod + x first.sh
Debian:/#. / first.sh
Hello world
After that
Debian:/myshell# echo $? (described in detail later in this section)
0
If 0, it is normal.
After reading the above, do you have any further understanding of how to understand shell-0? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.