String handling of Shell programmingIn the shell, because it is a weakly typed language, all variables are strings without declaring the variable type beforehand. So the processing of strings is very important.The following are common operations on
Background:The default specified file directory for Hadoop's HDFs file system mount is/mnt/disk{n}. When operators, accidentally attached to the disk in other directories, such as/mnt/data,/mnt/disk01,/mnt/diska, HDFs will select the root partition,
Regular Expression \ : exact match of the, excluding words containing [^ B-d]: does not contain B ~ D A \ {2 \}: A appears twice A \ {2, 3 \}: A appears 2 ~ 3 times A \ {2 ,\}: A appears at least twice [: Upper:]: uppercase letters (when used,
my friend asked me this evening to talk about his OA system (Asp. net) updated today. Registering the algorithm seems to have changed. It seems that the encryption shell has changed. Ask him to help him. it is a DLL Program and it is net2.0. It
1,Mkdir
-M, -- mode = mode set file mode (as in chmod), not a = rwx-umask
-P, -- parents no error if existing, make parent directories as needed
Mkdir-P dir1/dir2 // IfDir1Does not exist, also createDir1
Mkdir-M 755/usr/dir3 // and setMode
2,
Original article link
Cutting-edge
In the past, I wanted to write a bash-like GUI interface, so I had to use the libncurses library in C. I thought it was annoying.
With the dialog tool, you canProgramInUse shell script to complete
Reference address:
The information returned by ifconfig includes the IP address, but it is troublesome to obtain the current IP address in shell.
Obtain Method
The formats of ifconfig returned information vary in different systems:[1]
Linux:
I just finished my work and just analyzed a reinforced game. I remembered that the analysis process was not found in the last post, and I recorded a video. Here I will simply add it.For the new version of this shell, there are also tutorials on the
1. Variables
A. When you need to assign a value to a variable, you can write it like this:
B. To use the value of a variable, you only need to add a $ (Note: When assigning values to variables, you cannot leave spaces on both sides of "= ".)
C. Then
The line starting with "#" is a comment and will be ignored by the interpreter.
Sh does not contain comments from multiple lines. Only one # sign can be added to each line. It can only be like this:
# ------------------------------------------ #
This is a simple shell script, which contains a lot of shell script writing skills, although the script is compiled from other video tutorials, however, it has paved the way for me to write shell scripts in the future.
#!/bin/bash############## main
Understanding:
By default, Linux commands obtain input from the standard input device (stdin) and output the result to the standard output device (stdout) for display. Generally, the standard input device is the keyboard, and the standard output
I 've been learning Perl, and shell has forgotten about it. Today I wrote a small script to determine the operation when the second variable of the script is not equal to a certain string.
If [$? -EQ 0] & [$2! = "WP"]
Then
: # Omitted
Fi
If the
16. find:
The following is an example of how to use the find command:/> Ls-l# List the test files contained in the current directory-Rw-r --. 1 root 48217 Nov 12 00:57 install. log-Rw-r --. 1 root 37 Nov 12 00:56 testfile. dat-Rw-r --. 1 root 10530
[Shell] example of if, for, while flow statement and integer string comparison
Preface:
In fact, Shell is a command interpreter that explains the commands entered by the user and sends them to the kernel. In addition, Shell has its own programming
[Shell] dataset and difference set of data
Statistical data often requires files A and B. Now you need to know the data in the file, which are shared by A and B, which only appear in file A (or those only appear in file B ). You can use the uniq
[Shell] if common judgment ConditionsIF you have written a simple shell script before the judgment, it is not a job O & M, and the work related to the system is relatively small, so it is not very skilled.Recently, as the system has encountered
1. first introduce the usage of alias (alias)
Alias la = 'LS-a' alias B = 'CD... 'and so on
Alias is a good thing. It can save a lot of time when using shell.
2. But one day I found that the if statement cannot be used when executing the shell
Shell programming regular expression:
1: metacharacters []. *? + () | {}^ $
2: [a-z0-9] indicates one that matches any number and letter
3: [^ a-z] matches any letter
4: AB + c + indicates matching the characters before one or more plus signs.
5: AB
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