Shell Four Swordsman Primer

First,ShellFour The Swordsman (grep)grep fetch rowsRegular Expressions: [0-9] denotes character match 0-9{1,3} indicates that the number of matching characters is less than 3. Example one: [email protected]

Shell Scripting Basics (eight)

One, expect script synchronization file[[email protected] ~]# cd /usr/local/sbin/[[email protected] sbin]# ls01.expect 02.expect 03.expect check_ng.sh lvs_dr.sh lvs_nat.sh mon nginx_log_rotate.sh[[email protected] sbin]# vim 04.expect

The shell command provided by Hadoop accomplishes the same task

Create a TXT file in the "/home/hadoop/" directory of your local Linux file system, where you can enter some words.mkdir hadoopcd Hadooptouch Test.txtgedit test.txt To view the file location locally (LS)Ls-al Displaying the contents of a file

Linux shell string manipulation

Recently in the shell script, found some shell strings of the Sao operation, can improve efficiency.String Read ${var}: Value of variable var ${var-default}: If Var is not declared, the value of Var is $default ${var:-default}: If

Pipe and job control, shell variables, environment variable configuration files

Pipe character | Function: The output of the preceding command is given to the following command job control CTRL Z pauses a task [[email protected] ~]# vim 1.txt [1]+ 已停止 vim 1.txt[[email protected] ~]# vim 2.txt [2]

Pipe and job control, shell variables, environment variable configuration files

Pipe character and job control | Give the result of the previous command to the following command processing.[[email protected] ~]# cat 1.txt |wc -l 统计行数5[[email protected] ~]# cat 1.txt |grep ‘aaa‘aaaa 剪切出aaa的行 CTRL Z pauses a task,

Shell script detects if the network is unblocked

When the shell initializes the installation script, it is necessary to install some RPM packages from the network, all of which need to detect the smoothness of the network first.Code#检测网络链接 &&FTP upload Datafunctionnetworkandftp () {#超时时间 timeout=5#

24th Lesson Shell's special symbols and Cut_sort_wc_uniq_tee_tr_split commands

First, special symbols' * ' wildcard character, any of any characters'? ' any one character' # ' comment characters' \ ' de-semantic characters' | ' pipingThe prefix of the ' $ ' variable'!$ ' combination, regular inside means end'; ' multiple

Shell implementation compresses multiple files

Write a script in the Linux environmentFrom the keyboard to let the user enter several files, the script can archive this several files into a file:1. First introduce the CASE statement formatCase SWITCH invalue1)Statement...;;value2)Statement...;;*)

Custom functions in the shell

Customizing a function for printing function parameters[[email protected] shell]# vim fun1.sh#!/bin/bashpri(){ echo "第一个参数为 $1" echo "第二个参数为 $2" echo "文件名为 $0" echo "总共有$#个参数" }pri a b #调用函数Execution

Shell Learning variables and quotes

1. The concept of variables: variables are stored in the program of the user's memory space, the variable name is the address of this memory space, the value of the variable is stored in the computer memory. Variable definition: It is simple to

Linux centos7 Shell Introduction, Command history, command completion and aliases, wildcard characters, input and output redirection

First, Shell introductionShell scripting is an essential part of everyday Linux system management, not a shell, not a qualified administrator.The shell is the intermediate medium that the system interacts with the computer hardware, a system tool.

The skillful use of the shell command cut

Requirements: Remove the IP field from the log and sort the statistics. General use awk command if the IP address is the first field thenawk ' {print '} ' filename |sort |uniq-c|sort-nrWhat if it's not the first field and there are several

Shell file lookup and compression commands

Locate command1.locate filenameFuzzy match as long as the file name contains the keyword can beNon-real-time lookup, faster than find.Rely on index database/var/lib/mlocate/mlocate.dbAutomatically run once a day to update the database.UpdateDB

(a) The first day of the shell

CentOS default shell version: Bashecho $SHELL Opening language ID: #!/bin/bash在执行bash脚本的时候,内核根据#!解释器来确定改用哪个程序解释这个脚本中的内容 Script comments在shell中,#开头的是注释; Execution of Shell scripts方式一:bash script-name或sh script-name (推荐使用)方式二:./script-name

Linux Logging User shell command

Add the following in/etc/profile: Export lc_all=ctmout=3600histfilesize=2000histsize=2000histtimeformat= "%Y%m%d-%H%M%S:" Export Histtimeformatexport prompt_command= ' {command=$ (History 1 | {read x y; echo $y;}); Logger-p local1.notice-t bash-i

Shell Test condition judgment

Test condition judgment# symbol [] equals test commandTen 5 # Judging the size of echo $? # View the previous sentence The test command returns the status "hello" # To determine if the string length is 0[$ 0"success" | |

Shell script programming Shell files contain

1. Like other languages, the shell can also contain external scripts, which makes it easy to encapsulate some common code as a standalone fileExample: The testshellfileinclude.sh script is as follows:the #!/bin/Bash#shell file contains the following

Arrays in the shell

Arrays are not used very often in the shell, but are very useful, let's take a look at some of the uses of arrays in the shell: Define array a= (1 2 3 4 5); Print array echo ${a[@]}The contents of the array can be either numbers or letters, as

Linux Shell Programming (v): arrays

ArrayAn array is an ordered sequence of elements. If a collection of variables of the same type is named, the name is an array name. Each variable that makes up an array is called the component of an array, also known as an element of an array,

Total Pages: 541 1 .... 344 345 346 347 348 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.