I just got started with Linux development and recently encountered the problem of calling shell scripts in Java. I found a method suitable for cainiao-level development, as described below:
Add # In the first line of the shell script to be run
Determines whether the parameter is an integer.#! /Bin/bash function inttest () { for Arg DO # Arithmetic Operators, when the parameter is an integer, the execution fails. ($ Arg) 2>/dev/null # blocking error information If [$? = 0] then
The company's network is too bad, syncCodeThe speed is only 15 kb/s !!!
I can't bear to go online and find a shell script:
#! /Bin/bash echo "====== start repo sync ====" repo sync while [$? = 1]; DO echo "===== sync failed, re-Sync
1. Basic Knowledge
CAT/etc/ShellCHSH/bin/tcshEmacs = Vi?PdkshZsh
B C KPID is 1 not 0
Home variables exists in passwd, And the last entry of passwd is sh.
PS-Ef svr4PS au for BSD/Linux ps
Echo $ statusEcho $?
EUID // can be changed, like
Recently, the customer has been engaged in projects. The customer is eager to see the results. The boss always forgets to buy a domain name. There is no way to register a free domain name through the peanut shell for configuration. Because the
The current user configuration information in the registry is as follows:-----------------------------------------------------------------------------Windows Registry Editor Version
This document describes the basic usage of sed. We recommend that you take a look at the details of SED and awk In the third edition. Sed matches the regular expression to output the command to process the text, it is a headache to be unfamiliar
Http://hi.baidu.com/zxvb3000/blog/item/9ecd2b022d15490b4bfb5199.html
1. Test commandThe test command is used to check whether a condition is true. It can be used to test values, characters, and files,The test characters and corresponding functions
When the script needs to interact with the person running the script.
BASH Shell provides command line parameters (data values added after the command), command line options (single character values for modifying Command Behavior), and direct
From: http://www.jb51.net/article/34323.htm
Note: The subscript of the array in Shell starts from 0 by default.
1. Place the string in an array to obtain its length.
Copy the Code as follows:#! /Bin/bashSTR = "a B -- n d"Array = ($ Str)Length =$ {#
Is_upper ()
# Is_upper
# Checks tosee if we have a string in upper case
# To Call: is_upper $1
{
# Check we have the right Params
If [$ #-ne 1]; then
Echo "is_upper: I need a string to test OK"
Return 1
Fi
# Use awk to check we have only
Shell scripts are the core of Linux, while regular expressions are the core of shell scripts. Understanding regular expressions can quickly match the content to be searched, lay a solid foundation for future shell script programming.
The contact
Sometimes a task runs for a long time and needs to be run in the background. Otherwise, the task will be terminated after the console is launched. This article describes how to run the task in the background.
For example, for a shell script,
System: Ubuntu 9.04
"After logging in, type CHSH and press to change the default shell. Depending on the system, you may be asked to enter your login password and the name of the shell to be used. Enter the complete path of the shell to be used.
1. The method for modifying the language family is:
[Root @ test root] # lang = en (specify other syntaxes as needed, such as C)
[Root @ test root] # export Lang
Linux VI deletes all specified characters
Press ESC to return the command
This article is based on the following English documents: http://www.adminschoice.com/docs/crontab.htm.
Cron is a UNIX tool that uses cron background processes to automatically execute tasks at a specific time in the future. These tasks are usually
Standard InputThe standard input is the file descriptor 0. It is the command input. The default input is the keyboard, or file or other command output.
Standard outputThe standard output is the file descriptor. 1. It is the command output. The
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