. Sometimes we need to read the first line from the BEGIN statement block.We can specify some conditions for the rows that need to be processed, such as:The default field delimiter is a space. We can explicitly specify a delimiter with-F "delimiter": $ awk-f: ' {print $NF} '/etc/passwd$echo | awk ' {' grep root/etc/password | getline cmdout; print Cmdout} ' can read the output of an external shell command i
For Dev and UAT environments, databases must be in archive mode, but do not need to be backed up. Therefore, the constant increase in archive archiving logs results in a large amount of disk space consumption. In this case, you can use a shell script to automatically clear these archived logs at regular intervals. This article provides a script to clear archived
] ~]#/etc/profile or [[email protected] ~] #source/etc/profileMake the change effective, if there is no error stating the success.Verify that there is data in the log[Email protected] ~]# More/var/log/201107.log2011-07-21 17:29:08 ##### Root PTS/2 (192.168.23.250) # # # # # # # /etc/profileYou can see that there's already data inside.You can also usePrompt_command= ' {date ' +%y-%m-%d%T ##### USER: $USER IP: $SSH _client PS: $SSH _tty # # (History 1 | {read x cmd; echo "$cmd";}) ";} >> $HISTORY
SHELL script-full explanation of tr command usage and features, shell script-tr usage
Directory:1.1 Introduction1.2 tr ing1.3 completely matched replacement1.4 compressed symbols1.5 Delete symbols and supplements
1.1 Introduction
Tr is mainly used to map the result set, comp
Shell script -- cut command, shell script -- cut
Directory:1.1 option description1.2 filter by field1.3 Use -- complement1.4 split by byte or character1.5 Use -- output-delimiter1.6 specify the range in cut
1.1 option description
The cut
As a widely used debugger under Unix/linux, GDB not only provides rich commands, but also introduces scripting support: one for existing scripting language support, such as Python, where users can write Python scripts directly, and GDB calls the Python interpreter to execute The other is a command script, in which the user can write GDB commands that GDB has prov
(unset), then return to word, but do not change the value of var.
${var:=word}
If the variable var is empty or has been deleted (unset), return to Word and set the value of Var to word.
${var:?message}
If the variable var is empty or has been deleted (unset), then send message messages to the standard error output, which can be used to detect whether Var can be properly assigned.If this substitution appears in the she
[Programmer technical skills] familiar with Unix/Linux Shell and common command line (I) file system structure and basic operations,
As a programmer, it is essential to be familiar with some unix/linux Command lines, because the servers used to deploy services are basically
Shell script learning notes ----- command execution, script learning notes
1. PATH variable: the main function of shell is to execute the command entered by the user. For example, after the user inputs a "ls"
The key to using command-line arguments is that the shell script needs to interact with the person who is running the script.The bash shell provides command-line arguments to add data values after the command,
Tags: permissions test content Universal inittab ATI script Run SystemTurn http://blog.itpub.net/23135684/viewspace-668924/Unix general use Method 3, for deploying OSWMethod One:Edit/etc/rc.d/rc.localJoin the command you want to execute.Such as:[email protected] rc.d]# cat rc.local#!/bin/sh## this script. 'll is execut
1. The problem addressed
When you need to enter many commands at once, for example, to remove files from multiple directories at once
Copy Code code as follows:
CD Dir1
RM file1.temp
Cd.. /.. /dir2
RM-RF Dir3
When you don't bother typing a long command or simply can't remember that long command, such as generating ctags
Ctags--languages=c++--exclude=third_party--exclude=.git--ex
Here are just a few common shell commands, some commands that require root user privileges, see: PHP executes shell commands with root privilegesPHP executes shell commands and can use several functions:String system (string $command [, int $return _var]) string exec (string $comm
[[emailprotected] ~]# date -d "-1 day"Sun Feb 4 18:19:25 CST 2018[[emailprotected] ~]# date -d "-1 month" +%F2018-01-05
Date-d "-1 years" a day ago
[[emailprotected] ~]# date -d "-1 years" +%F2017-02-05
Date-d "-1 month" month ago
[[emailprotected] ~]# date -d "-1 month" +%F2018-01-05
Date-d "-1 min" A minute ago
[[emailprotected] ~]# date -d "-1 min" +%F2018-02-05
Date +%w, week date +%w the first few weeks
[[emailprotected] ~]# dat
, code readabilityDefinition of a functionGrammar:Function name (){Command sequence}OrFunction name () #function可以不写{Command sequence}Note: When a function is called: without ()Call Syntax:Function Name parameter 1 parameter 2 ....Variables in the function are global variables, no local variablesWhen calling a function, you can pass arguments, and use $1,$2 ... to reference the passed arguments in the funct
1#!/bin/Bash2 ############################################3# @content Chapter8,9of Linux Command line and Shell Scripting Bible4 # @reader Gavin5# @date the/ A/ -6 ############################################7CHAPTER88 9+user varriable make the shell A-computer programTen 1when assigning a value to a user-defined variable, no spaces can appear One 2.
Shell Command Line writing rules
An understanding of the basic functions of shell command lines helps to write better Shell programs. When executing shell commands, multiple commands can be run on one
Linux command line and shell script programming Daquan graphic desktop script programming create text menu create menu layout [plain] #! /Bin/bashclear # clear screen echo-e quot; \ t \ tMenu quot; echo-e quot; 1. \ tDisplaydiskspace quot; echo-e quot; Linux command lin
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.