The following script backs up all the source files to be edited into the/bak directory, and all path locations remain unchanged, such as Vii/etc/hosts, and the/etc/hosts is copied to/bak/etc/hosts.
# CAT/SH/VII
#!/usr/bin/bash
#判断源文件是否存在, exist
Using the Runtime.execute method, we can run Linux shell scripts in Java programs, or execute other programs Now through the Commandhelper.execute method can execute the command, the class implementation code as follows: Package
This article mainly introduced the Linux Shell Script Series tutorial (Seven): script debugging, this article explained the bash built-in debugging function and the custom debugging function and so on content, needs the friend may refer to under
Shell Common knowledge
First, the user login into the system after the system environment variables
$HOME user's own directory$PATH directory to search for when executing commands$TZ Time Zone$MAILCHECK every few seconds to check for new
As a command line seeker, you may find yourself repeating the same commands over and over again. If you always use SSH to access the same computer, if you always connect a chain of commands, if you always run a program with the same parameters, you
Demo Effect:
1, the first level menu
2, Level two menu
3. Perform operation
Script reference:
Copy Code code as follows:
#!/bin/bash
#author Lic (Oldboy Linux student)
#date 1304
disk_no= "/DEV/SDA1"
Nginx_dir= "/usr/local/
1. Define functions within the shell file and refer to:
Copy Code code as follows:
[~/shell/function]# Cat factorial.sh
#!/bin/bash
function factorial
{
Factorial=1
For ((I=1;i Todo
factorial=$[$factorial * $i]
Done
Write a shell script under Windows, upload to Linux run the Times wrong:
Copy Code code as follows:
[Root@localhost test]#./test.sh
-bash:./test.sh:/bin/sh^m:bad interpreter:no such file or directory
Test.sh Source:
Copy
There are a lot of special symbols in the Linux shell, which we should pay special attention to when we write Shell script: On the one hand, we need to know the usage of these special symbols, these symbols can be used to achieve a multiplier effect;
The shell monitors the site for unusual script, such as an abnormal automatic email notification to the administrator.
Process:
1. Check that the Http_code returned by the Web site is equal to 200, if not 200 as an exception.
2. Check Web site
Scripting programming languages and compiled languages:
Scripting programming Language: (Bash)
The scripting language is usually interpreted (interpreted), which is read into the program code primarily by the interpreter (interpreter) and is
One, install secure shell, then the SSH Secure Shell client and SSH secure File Transfer client two shortcuts will appear.You need the server's IP address, username and password to connect to the server.Second, use SSH Secure file Transfer client to
The terminal realizes the reading and writing of the data stream in the file;The list of REDIRECT commands is as follows:
Command
Description
Command > File
Redirects the output to file. Write terminal data
There is also a very useful feature in Bash's operating environment, which is the wildcard character (wildcard)! It's even easier for us to use bash to process data! Below we list some commonly used wildcard Fu Yi:
Symbol
Ulimit is used to limit the resources that the shell startup process consumes, and supports the following types of restrictions: the size of the kernel file created, the size of the process data block, the size of the shell process creation file,
Use the shell to monitor CPU, disk, memory usage, reach alert thresholds and email notificationsAnd with the task plan, you can get the alarm information in time#!/bin/bash############################################## #Author: liuzhengwei - [email
Special characters in the shellIn addition to using ordinary characters in the shell, you can use special characters that have special meanings and functions. They should be used with special meaning and scope of action. Each of these special
The first point is clear:/etc/profile is the configuration file that sets the environment variables for all users,/home/omm/.profile is the configuration file (omm User) that sets environment variables for a specific user . But the important
Transfer from http://roclinux.cnThis original article belongs to "Linux greenhouse" blog, the blog address is http://roclinux.cn. The author of the article is rocrocket.===[Start of body]Sometimes learning scripts, you will find the sort command
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