# ubuntu terminal under command line Color configuration # parses out the branch name from. Git/head:find_git_branch () {local dir=. Headuntil ["$dir"-ef/]; Doif [-F "$dir/.git/head"]; Thenhead=$ ( usage: Append the above code to the ~/.BASHRC file,
Meet
Meaning
&&
Command1 && command2: Command 1 returns True (command return value $? = = 0) after which command 2 talent is run. Can be used for if inference.CP 1.txt.. /&& echo "succes" #-->successCP 1.txt.. /&& rm-f.
The first part: expect explanationExpect allows us to automatically log on to remote machines, and can implement automatic remote execution of commands. Of course, if you use key authentication without a password, you can also implement automatic
First, the demandHere, I simplify, because this afternoon operation both texts are 10 tens of thousands of lines, but only filter out these two files contain the same or different string ppid.Two, step together1. Document HA1Abc2. Document HA2Acd3.
One, read user input (1) The basic Read command accepts input from a standard input or file descriptor and assigns the received data to a variable.1 Cat read. SH 2 #!/bin/bash3# Test the Read command4echo" "5read name6echo"Hello $name "The-p
Stacking of commands;However, many commands do not have idempotent, and it is necessary to use program logic to determine whether the running conditions are satisfied, so as to avoid errors in their operation.To run the script:(1) Give execution
I wrote a script quit.sh, as follows:1 #/bin/bash2 If [$#-lt 1];then3 echo "must input at least one parameter!"4 Exit 15 fi67 if [= = "Q"];then8 echo "quit!"9 echo "$ (WhoAmI) quit @ $ (date)" >>/tmp/quit.txt #这里访问了quit. txtExit 0One elseecho "Wrong
Hadoop shell command operation, enter the Hadoop carriage return can be found:The commonly used commands are:Hadoop Namenode-format This is the command used to format the file system before starting Hadoop.Hadoop Dfsadmin This is the management
Scripting features: Batch or single SSH-free login authenticationScript scenario: When deploying a cluster, most implementations want to configure the management node with SSH-free login from the node, writing the following script to simplify the
This is my first shell Script, write chaos, experiment, or is available, and now on my own Web server running up!! ~~#!/bin/bash# this shell script to prevent SSH brute force hack #auther:aaron guo#date:jan 8 2016#version:1.2# Specifies the shell'
* Represents 0 or more arbitrary characters? Represents only one arbitrary character# comment Symbols\ de-signifier symbol[[email protected] ~]# ls #1. txt #将后面内容注释 only run LS111 1.tar 3.txt Install.log yasuo.zip111.tar 1.txt anaconda-ks.cfg
Background:A lot of people have been converted from C + +, after reading the study document, stepping into a lot of pits1 assigning values to variables don't have spaces# correct a = 123 # error2 if statement [] to leave a space, the variable is
Program execution Flow:1. Start accepting mail.2. Check if the sender is in the blacklist, and if it refuses to accept it, continue3. Check whether the sender is in the whitelist, and if it is receiving mail, continue4. Keyword filtering of the
First,shell variables1. There can be no space between the variable name and the assignment symbol.2. The first character must be a letter a~z or a~z.3. Using a defined variable, add ' $ ' before the variable name, such as:Myname= "Firefly"Echo
Example: nohup/mnt/nand3/h2000g >/dev/null 2>&1 &for & 1 More accurate should be the file descriptor 1, and 1 is generally representative of Stdout_fileno, in fact, this operation is a dup2 (2) call. He standard output to All_result, and then copy
# Linux Shell splits strings into groupsresult=$ (facter | awk '/ipaddress/&&!/ipaddress_lo/{print $ "$ $} ') array= ($result)# Determine if a variable exists (not to determine whether it is empty)If [-Z ${var+x}]; Then echo "Var is unset"; else
Compiling Java projects is generally straightforward with the IDE or with tools such as Ant and Maven, and few people use pure shells to compile Java projects. Just meet such a should, use this blog post to make a record.Case: I wrote a Java project
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.