4) Functions
If you write a bit more complexProgram, You will find that the sameCodeAnd you will also find it much easier if we use a function. A function looks like this:
Functionname ()
{
# Inside the body $1 is the first argument given to
During shell programming, you often encounter the problem of getting the file name and file suffix. The general solution is as follows:
1 # Code 2 file = " thisfile.txt " 3 echo " filename :$ {file %. *} " 4 echo "
From: http://share.blog.51cto.com/278008/583382
I wrote a very simple script to upload a file to a directory of HDFS in hadoop. When you enter the file name or directory name, an error occurs sometimes and you need to delete the incorrect
I would like to remind you that this client sends a UDP heartbeat packet to the server through port 6060. The package information is as follows:
17:19:35. 734433 IP 192.168.1.7.32773> 61.152.96.119.6060: UDP, length 2017:19:35. 784568 IP 61.152.96.
1. netstat
1) netstat [Option]
Parameter descriptions related to routing:
①-R: lists the route tables. The function is similar to the route command;
②-N: The Host Name and service name are not used. The IP address and port number are used,
1. When the crontab command is executedProgramIt is a little different and should be noted. For example, PS aux | grep File
If the statement is executed directly in shell, the search scope is only the process currently executed in top, and the
Let's take a look at some common shell tips.
CTRL + u Delete the cursor to the beginning of the current row
CTRL + k Delete the cursor position to the end of the current row
CTRL + a move the cursor to the beginning of the current row
CTRL + e
If there is no body file, use echo to directly extract the body, for example:
Echo "this is content" | mutt-s "this is subject"-A/path/Yourfile abc@local.domain-C bbb@local.domain
If there is a body file, use
CAT/path/contentfile | mutt-s "this
1. for arithmetic operations. There are several assignment methods:
Let a = 1 + 2Echo $
A = $(3 + 3 ))Echo $
A = $ [4*4]Echo "$"
Set $ [A = 5*5]Echo "$"
2. Determine whether a directory exists:If [-d "$ (PWD)/.../candpointer"]; thenEcho "
Shell string truncation problem:1. Linux Shell intercepts the first eight characters of the character variable by using the following methods:1. expr substr "$ A" 1 82. Echo $ A | awk '{print substr (, 1, 8 )}'3. Echo $ A | cut-c1-84. Echo $5. expr $
Original article link
Before using sshpass, see
Shell script Automation
Automatic SSH logon methods
1. Automatic ssh/SCP Method =
A is a local host (that is, a machine used to control other hosts );B is the remote host (
WCCommandTo count the number of bytes, number of words, and number of rows in a specified file, and display the statistical results.
Syntax: WC [Option] file...
Note: This command counts the number of bytes, number of words, and number of lines
13. Format and output the current running process of the specified user:
In this example, we pass the user list to the script in the form of Script Parameters. After the script reads the parameters, print the process of the user in the user list in
Sometimes you can write your own gadgets and prefer non-graphic interfaces. However, some applications still bring up a reminder to let you know.
Zenity is a very handsome thing. For its usage, refer to its -- help. I will not repeat it here. Here
WinCECustomized running upon startupShellIs the basic requirement of many systems, and sometimes needs to be blockedWinCEBuilt-inShell.WinCEMediumProgramYou can modify the registry and add a self-starting shortcut. It is convenient to modify the
Use the nohup command to make Linux programs always run in the background (from: http://www.einit.com/user1/11/archives/2006/3603.html)
In Unix/Linux, you generally want to run a program in the background. Many of
Shell also has a real debugging mode. If an error occurs in the script "strangescript", you can debug it as follows:
Sh-x strangescript
This will execute the script and display the values of all variables.
Shell also has a mode that only checks
========================================================== ==========
This article is the original khler, and the original author information and the original link of this article must be kept completely and completely reprinted.
Author: HeYuanHui
E-
After the CLR in-process side-by-side feature is introduced in. NET 4, we can use C # To compile Windows Shell. We can find related examples In Microsoft's All-In-One Code Framework. There are also several articles about it In the yard:
Windows
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