Here are some of the shell's commonly used shortcut keys, shortcut keys to play familiar with to a certain extent, can improve productivity drops ... + a switch to command line start + e switch to command line end + L Clear Screen
/*-------------------------------------------------------------------------------------------@ Black eyed poet --------------------------------------------------------------------------------------------*/A variable is a unit of computer memory
TopicWrite a script1. Pass a parameter to the script, this parameter is the user name;2. If the user exists, perform the following tasks* If the user's ID number is less than 500, display it as an administrator or system user;* Otherwise, display it
#!/bin/bash# gets all m3u8 files in the current directory, and Var=$(ls|grep '. m3u8'|Cut-D'.'-F1) #死循环 while[1=1 ] Do#循环每个文件 forStreaminch$var Do#获取当前最新视频文件 TS=$(ls-t|grep "$stream") for file inch$ts Do#存储M3U8文件文件名作为图片文件名, for* -, capturing
Reprinted from: Linux Shell arithmetic operationsThere are four ways in which the Bash Shell's arithmetic operations are:1: Using expr external programAddition R= ' Expr 4 + 5 'Echo $rAttention! ' 4 ' + ' 5 ' There should be a gap between the threeR=
Getopts is a built-in command of the shell, typically used to handle shell command-line options, but cannot handle long options (such as--prefix=/home, etc.) directly.Getopts has 2 parameters, the first parameter is a string, including the character
1. Two modes of this article command:Interactive mode, the shell environment for hive:hive > ....Non-interactive mode: normal Linux command mode :% ... ..2.Hive Shell Common operations1) Hive-e: Executes the specified HQL from the command line and
#! /bin/bashAction () {#1, get SVN update output/OPT/SVN/SVN/BIN/SVN update/opt/lampz/apache/web > File_out#2, gets the number of rows through the output file File_outline=$ (wc-l File_out|awk ' {print $} ')#3, if the number of rows is greater than 2
Scripting: Stacking of commandsThe first line of any script:#!/bin/bash: The Interpreter pathIn addition to the previous # number as a commentExecute permission before script execution: chmod +x file nameCondition Judgment in bash:Condition Test
Tenth line:https://leetcode.com/problems/tenth-line/Test Instructions: prints the 10th line of a file.The problem involves several points:1. How do I read a file?2. How do I find line 10th?3. What if the file is empty or less than 10 lines?Solution:1
$ represents the ID of the current shell process, which is the PID $echo $$Run results2934List of special variables
variables
meaning
$0
filename of the current script
arguments passed to
In general, you may need to switch the root user to another user for execution during the automation process, such as: OralceHowever, the execution of the command will return to the root user, continue to execute other commands under the root
Automatic installation:Of course, if you trust this open source project author, you can try to use the automatic installation method.
wget Https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh-O-| Sh
Manual Installation:1.
First, Introduction1. Variable type:User-defined variables (local variables)Environment variables: Define each user's operating environment, has learned path,ps1; to be permanent, write to the corresponding locationPre-defined variablesPositional
grep Basic Usagegrep [Options] [mode] [file:]Options-C outputs only the number of matching rows-I ignore case when searching-H does not display file names when querying multiple files-L searches only for matching file names, not specific matching
Idea: After Nginx starts, there will be a nginx.pid file in the specified location, by judging whether the file exists. Determine if Nginx has been started.#!/bin/bash#this is my first try to test write a shell to control nginx Daemon#History 2015-08
Transferred from: http://my.oschina.net/aiguozhe/blog/41557, and the content was verified and modified.1. Take the lengthstr="abcd"expr length $str 4echo ${#str} 42. Find the location of the substringIt seems that only a single character is
Modified by the Geotrace script, the original script has a lot of problems, looked up some awk data to solve the original problem.mtr-0.86 version installation failed, need to update some software, so the use of 0.80can also use Nali this software,
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.