1. Test SwitchSome test instructions are included in the shell, and the following table lists the meanings of these test instructions and whether they are available for the test command, bash, Ksh.
Switch
Test
Bash
Ksh
Give you a full, you in the Linux environment to try to understand more:The execution name of this program$n the nth parameter value of this program, n=1..9$* all parameters of this program, this option can have more than 9 parameters.$# the number
Zhanhailiang Date: 2014-10-181. Load the configuration file sequence during the Linux login process:/ETC/PROFILE→/ETC/PROFILE.D/*.SH→~/.BASH_PROFILE→~/.BASHRC→[/ETC/BASHRC]You can view the default ~/.BASHRC file as
Idea: (1) get "." The I node number, which is called N (using stat)(2) ChDir. (using ChDir)(3) Find the node with inode number n and get its file name.Repeat the operation until the current directory "." The inode value equals "..." The Inode
File descriptor
STDIN: standard input, receive input from mouse, keyboard or other input device, file descriptor is 1
Stduot: Output All normal output results, file descriptor is 2
STDERR: Output All error messages, file descriptor
Because the shell appears to be a common feature between UNIX systems and is standardized by POSIX. As a result, shell scripts can be applied to many systems once they are "written attentively". Therefore, the reason to use shell scripts is based on:
1. Write a script that calculates the factorial of 10 using a loop #!/bin/shFactorial=1For a in ' SEQ 1 10 'Dofactorial= ' expr $factorial \* $a 'Doneecho "10! = $factorial "2. Write a script, after the execution, print a line prompt "Please input a
The execution name of this program $n the nth parameter value of the program, n=1..9$* all parameters of the program, which can be more than 9 parameters. $# the number of parameters for this program $$ the PID of the program (the current process ID
There are three main forms of processing Linux input in shell scripts:1) Treat them like command line arguments, and obtain corresponding input parameters by corresponding positional parameters2) through getopt and getopts These two commands 3)
Divided into two partsFirst, install the B-shell interpreterInstall Cygwin eclipse to find the installed bin pathHttps://cygwin.comSecond, install the editor shelledDownload can get one: net.sourceforge.shelled-site-2.0.3help→ Install new software
Category:
You can execute another shell script (or non-executable file, mainly used to obtain the value of some variables) in one shell script :. file name (including path) or variable = file name (including path ). $ variable Note: there is a
#!/bin/bash#./zabbixagent.sh 172.16.103.16 172.16.103.134#$1 master address, $2 local_listen_ip groupadd zabbix && useradd zabbix -g zabbixcat >>/etc/services
This article is from the "muzinan technical blog" and is not reposted!
Zabbix
When writing shell scripts, brackets and brackets are often used. I. Parentheses, Parentheses () 1. Single parentheses. ① Command Group. The commands in parentheses will open a new sub-shell for sequential execution, so the variables in parentheses
1. Specify the script interpreter at the beginning
#! /Bin/sh or #! /Bin/bash
2. Provide the function description, author, version, and other information at the beginning
# Description: # Author: # contact: # Last edited: # version:
Note: you
Shell operation command:
HDFS path, defined in core-site.xml
fs. Default. Name
HDFS: // master. hadoop: 9000 master. hadoop namenode Host Name
Use/to replace the current absolute path
Hadoop FS-ls/View content in the root directory of
Use shell commands to analyze statistics logs and shell commands to collect statistics logs
When you need to collect user log information and analyze user behavior, you can use shell to conveniently retrieve a lot of data and place it in excel for
Linux shell redirection and shell redirection
Redirects the shell error output to the standard output to record the error information of the script.
For example:
/Root/test. sh> test. log 2> & 1
Note:
Linux first loads/etc/rc. d/rc. local
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