Several ways the shell script reads data:1. keyboard input, default2. read from the file3. Pass through Pipeline command
Functions of Echo:C: No Line changeF: Paper FeedT: Jump latticeN: Line WrapRepresents an escape, for example: "/dev/rmt0"
Implement code One,
#!/bin/sh # to
determine if a file exists
# link:www.jb51.net
# date:2013/2/28
mypath= '/var/log/httpd/
' myfile= ' Var/log/httpd/access.log "
# Here's the-x parameter to determine if $mypath exists and has executable
A key to start the cluster shell script, including HDFs HA + yarn related to all the programs, fbi00x is the host name for your reference:
#!/bin/bash echo "-------------------------Step1----------------------------" echo "now,starting zookeeper.
In fact, it has been written before, but only to achieve the automatic creation of CA certificates and other documents, the recent time is quite well-off, plus the use of this dongdong almost ubiquitous, and therefore, on its basis to do some
1. Powerful and useful shell commandGenerally speaking, computer hardware is composed of operators, controllers, memory, input/output devices and so on, and let a variety of hardware devices and can work together to operate the system core. The
What is a shell script. First, it is a script and cannot be used as a formal programming language. Because it's running in the shell of Linux, it's called a shell script. To be blunt, a shell script is a collection of commands. For example, I want
1, for: Read different variable values, execute the same set of commands one by one, until the value is complete exit, variable values are separated by a spaceGrammar:For variable value in value listDoCommand sequenceDone2, while: Repeated testing a
67. Shell Script Introduction, shell script structure and execution, date command usage, variables in shell scriptFirst, Shell script introductionThe shell is a scripting language aming_linux blog.lishiming.netYou can use logical judgments, loops,
Logical judgments in shell scripts
Format 1:if condition; Then statement; Fi (Common)
#以命令的方式表达[[email protected] ~]# for i in `seq 1 5`; do echo $i; done12345[[email protected] ~]# for i in `seq 1 5`> do> echo $i>
Reprinted from: http://dos2unix.cn/link/4801. Standard input stdin file descriptor is 0, standard output stdout file descriptor is 1, standard error stderr file descriptor is 22./dev/null empty equipment, equivalent to garbage bin3. REDIRECT Symbol:>
Recent project requirements, need to write some shell script interaction, the pipeline is not enough time, expect can be very good to implement the interaction between the script, search for information, found that many articles on the Web are
Scripting is essential for Linux testing, and the name of the shell script can be arbitrarily defined, and no suffix, such as the name can be written abc,smartzip, as long as the runtime typeThe./smartzip will be able to run the script.Do not use
In the shell program, the most commonly used FD (file descriptor) is about three, respectively:0 is a file descriptor that represents the standard input (stdin)1 is a file descriptor that represents the standard output (stdout)2 is a file descriptor
Ix. unfoldingThe expansion of the command line is done after splitting the word into words. There are seven types of expansion: curly brace expansion, wavy line expansion, parametric and variable expansion, command substitution, arithmetic expansion,
For example, comparing strings, judging whether the file exists and whether it is readable, etc., usually uses "[]" to represent the condition test.Note: The space here is important. The space to ensure the square brackets. I have wasted a lot of
This time the collection is a relatively basic Linux command, in fact, the Linux command does not have to remember each, as long as the use of the command can be consulted to see the use of.
System Information
The processor
function allows us to divide a complex function into several modules, which makes the program structure clearer and the code reuse more efficient. Like other programming languages, the Shell supports functions as well. The Shell function must be
2011-09-27 22:11:51| Category: rhel5_033| Report | Font size Subscription Linux uses Prompt_command to realize audit functionThis system audits, records what the user, at what time, did what operation. The information is then recorded in a
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.