#!/bin/bash#截取字符串#path =ss/usr/share/src/root/home/adminPath=ss/usr/share/src/root/home/admin/src/addEcho $pathEcho ${path%src*} #从右向左截取第一个 the string after SRCEcho ${path}Echo ${path%/*} intercepts the first/second string from right to leftEcho
1. Use a command to find the files that have been modified in the last 24 hours in the/etc/directory, and the suffix name isthe. log file and delete it.Find/etc-type f-mtime-1-name "log* "-exec rm-rf {} \;2. From the Test.log file, find the row
A fragrant chestnut is better than words#!/bin/bashfoo= "Good" # Without spaces bar= "Hello World" # with spaces awk ' BEGIN {print ' $foo ' "; "'" $bar "'"} 'The pest above maintains the usual practice of enclosing the awk code in single
If...elseif [$1x = = "AB" x]; Then echo ' You had enter AB ' elif [$1x = = ' CD ' x]; then echo ' You had enter CD ' Else echo ' You had enter UNEXPE CTED word "fi Case...esacA switch case similar to another language, however, here is a
Three ways the shell command executes continuously:1, command 1; command 2; command 3Executes the command sequentially, regardless of whether the previous command executed successfully.2. Command 1 && Command 2 && command 3The next command is not
Tag: element represents article string output shard for form berThe role of variablesForbidden spaces on both sides of the equals signFor loop#语法一 for variable in value 1 value 2 value 3 : Do block done # #语法二 the for variable '
ObjectiveToday, when writing a script, found that the previous phase used some of the usage is still need to go to Baidu Search, and find the answer also need to filter, delay writing script time, this article on the comparison between the string
1. ${ }A more precise range of defined variable names is used for variable substitutionFor example:A=bEcho $ABOriginally intended to replace the result of a $ A and then a B-letter followed, but on the command line, the real result is only replace
8th Shell Programming Character Menu ManagementI. Shell function definitionFunction menu () {Echo ' This is a func!! ';}Two. Shell functions useMenuThree. How to use the Cat command HeredocCat
1, there are two records in the logID Start time End time0dedffee485e7ddbbff1236cfc0d91 2018-06-28 16:55:37 2018-06-28 16:55:52122dw049dc21b0a7dcdfegeat8c8 2018-06-28 17:21:01 2018-06-28 17:21:23How can I use the Linux shell command to calculate the
2. MacOS does not support ll (need to use LS-L implementation), in fact ll under Linux is ls-l shortcut keys.LS Displays the file in the current directory.LS-L Displays the file details in the current directory.#以下命令均不包含 ".", "..." Directories, and
There are two types of programming languagesStrong type: such as C language. The data has a specific type that is declared before it can be used. Data operations must conform to type requirements (e.g., string type data cannot be arithmetic directly
Shell Basics1.shell is the intermediate medium used when the system interacts with the computer hardware, and he is a system tool. If the computer hardware analogy to the human "body", the system kernel is the human "brain", the shell is the "five
1. basic usage of shell variables and usage of common symbolsThis section requires writing out the shell commands that implement the requirements , showing(1) Change the main prompt to the user's home directory name( Hint: reference material 4.6.8
When operating on SECURECRT, do the following carelessly:?????????????????? [[email protected] ~]# echo "Alias rm= ' echo this command does '" ">. Bash_profile?????????????????? [[Email protected] ~] #source. bash_profile?????????????? When the
1 Querying work status through the Web monitoring page of HBase discover the regions in transition area has a long-running task, you need to close Hbase-master and restart, and then this problem process I directly use/etc/init.d/ Hbase-master restar
One, the function in shell script?
The function is to organize a piece of code into a small unit, and give the small unit a name, when the code is used to call the name of the small unit directly.Format: function F_name (){command} function
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.