Known three time variables:time1= "Fri Aug 23 11:35:21"Time2= "Mon Sep 2 16:18:09"Time3= "Tue Sep 3 16:06:33"Given that these three times can be determined to occur in 2011-2013, how quickly to determine what year it is?
Want to output:time1= "2013/
Introduced
The grep command in a Linux system is a powerful text search tool that uses regular expressions to search for text and print matching rows. The grep full name is global Regular Expression Print, which represents the global regular
Recently write script, need to intercept the path parameter that function passes in the script, discover the following more useful method, record below:
File=/dir1/dir2/dir3/my.file.txt
We can replace each of the different values with ${}:
${file#
Environment: Successful in 2KSERVER+IIS5, permissions default IUSR permissions
IIS permissions: Script executable Description: On a 2K server, you can use the Server.CreateObject method to work with installed components by default.
For example, you
To turn the "functions in" chapter into a "library for", "scripts, extract all the functions and Concatenat e them into one of the big file. If We call this file library.sh, a test script so accesses all of the functions might look like this:
We've studied DD before. Create a test file, if you do not need to consider the size of the file, create a blank file, you might want to try
Touch:
Change the access time and modification time of each file to the current time.Files that do not
An array is a set of elements of the same data type arranged in a certain order, that is, a variable of the same type is named with a name and then numbered to distinguish their set of variables, which is called an array name, and the number is
Quote: I have never written a shell script before, perhaps because of laziness, perhaps not being forced to write a shell. However, some time ago, the job requirement required a rerun of the script for a few months, which ran regularly every day,
The VI Editor is the standard editor for all UNIX and Linux systems, and it is not as powerful as any of the newest text editors, but simply introduces its usage and a small number of instructions. Because of any version of UNIX and Linux systems,
The shell is actually a command interpreter that interprets the commands entered by the user and sends them to the kernel. Not only that, the shell has its own programming language for editing commands, which allows the user to write a program
Function Description: Tell the shell to remove the eval parameters, recalculate the contents of the parameters.Syntax: eval [parameters]Supplemental Note: Eval can read a series of parameters and then perform them according to the characteristics of
In recent time, when dealing with shell scripts, encountered time processing problems. The addition and subtraction of time, as well as the calculation of timing.
I. Time Plus and minus
The way to do this is to turn the base time into a timestamp,
If you're not familiar with the Linux shell array, see an article: The Linux shell array build and use techniques, this article is mainly about dynamically generating array series. There should be a lot of methods here, I mainly take a sum
The Linux shell is much more powerful in programming than in Windows batching, whether in loops or operations. There is no comparison of data types. The following is a summary of how an individual operates on an array while in use.
1. Array
Take a look at the wrong code first.
Copy Code code as follows:
#!/bin/bash
For x in ' LS */.*/.* '
Cat $x |do Echo $x
While Read line
Todo
C= ' echo $line |awk-f ' (' {print '} '
#echo $c
i=$ ((i+ $c))
Done
Echo
Done
Echo $i
Using shell script to automate the maintenance of the system is simple, convenient and portable.
But shell scripts are readable and writable, and are likely to reveal sensitive information, such as user name, password, path, IP, and so on.
Using the Rename command
========================
NAME
Rename-rename files
Synopsis
Rename from to File ...
========================
Copy Code code as follows:
#! /bin/sh
Inifile= "./dirlist.ini"
curpath=$ (PWD)
For Serverpath in $
Copy Code code as follows:
#!/bin/bash
Send_thread_num=13
Tmp_fifofile= "/tmp/$$.fifo" # script runs the current process ID number as filename
Mkfifo "$tmp _fifofile" # Create a new random FIFO pipeline file
exec 6<> "$tmp _fifofile" #
Most people use grep to find the specified process in the PS aux output when they write the shell filtering process, but they also display the grep process, such as finding the pptpd process, which matches two:
Copy Code code as follows:
The last article introduced the Linux to build the FTP server method, said the basic configuration of vsftpd, that is, anonymous and local, this time to configure the virtual user to use VSFTPD, the following is the specific steps:
First, establish
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.