These two days, because the work needs to do some of the process of work, look at some of the online examples, mostly through the way of pipeline files to achieve, and then think about it without so much trouble ...
The following is a simple
If you need to write a section to interact with the user, and need to input some sensitive information (for example: User password, license, etc.), the direct use of printf+read, the user input information will be displayed on the screen, which is
For example, to split test= "AAA,BBB,CC cc,dd dd", you can
Copy Code code as follows:
arr=$ (Echo $test |tr "," \ n ")
I can do that.
Copy Code code as follows:
old_ifs= $IFS
Ifs= ', '
Arr= $test
ifs= $OLD
When dealing with some data files on Linux, it is sometimes necessary to filter out the empty rows, and the various tools available in the system can accomplish this function. The usual introductions are as follows:1. grep
Copy Code code as
Often need to statistics Apache site traffic based on the IP address, the most basic script.
In descending order based on IP traffic:
Copy Code code as follows:
#!/bin/bash
#Script_name: Access_count
This example describes the Jquery.fancybox.js usage of the jquery Pinball plug-in. Share to everyone for your reference, specific as follows:
FancyBox is a jquery plug-in, powerful. Support to enlarge the picture to add shadow effect, for a group
First, we need to increase the user's ability to execute the script, that is,
Copy Code code as follows:
String cmdstring = "chmod a+x test.sh";
Process proc = Runtime.getruntime (). exec (cmdstring);
Proc.waitfor (); Block until the
Objective
Using the Shell
The basic shell commands and mechanisms are described and explained below.
First: Super Tools/terminals,xterms and Shells
One, Super tool
You've probably heard the argument that the command line (the Mommand lines) is
I. Overview
1. Product Overview:
Awk is a programming language used to scan and process text and data under Linux/unix. Data can come from standard input, files, and pipelines.
Awk represents the first letter of its author's surname, respectively.
First type:
#!/bin/bash service vsftpd start &>/dev/null if
[$-eq 0]
Then
echo "FTP is start"
Else
Service VSFTPD Start
Fi
The second type:
#!/bin/bash read-p "Input your file name" file_name
If [D-$file _name]//To determine whether the
Not long ago I saw two interesting commands in the book--script and Srciptreplay, which can record a terminal session in a file, that is, we can create a command-line video tutorial through a terminal session, or we can share session files with
The data flow redirection is used when adding logs to memcached, so I intend to summarize it.
Command
Description
Command > File
Redirects the output to file.
Command
Redirects the input
3.1 Regular Expression BasicsThe primary function of regular expressions is text query and string manipulation. is actually string filtering.Regular expressions include ordinary characters and metacharacters character, meta-character main, see the
The shell can be said to be an interpreter while providing a running environment for the code to run. and provides the programming capabilityThe shell does not have its own library, it just writes the applet commands within the command invocation
1. Field (column) Extraction command: Cut [option] file nameOptions:-F column number (extract the first few columns)-D delimiter (split column by specified delimiter)[email protected] sh]# cat student.txt idnamegendermark1alex male 112boby male
ObjectiveIn the Windows environment, organize the code, the code contains the. svn folder, which exists in all controlled directories and needs to be removed uniformly.But not familiar with Windows shell, want to use Linux rm to delete, how to
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.