Linux Shell script BASICS (6)

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

Shell string processing

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 "

BASH Shell escape key garbled

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

Installation Steps of peanut shell for Linux

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.

50. Linux shell commands, netstat, Traceroute

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,

71. Special Features of command execution in crontab in shell,/bin/sh

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

Common shell skills

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

Linux Shell sends emails with attachments

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

Several tips in BASH Shell

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

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 $

Automatic SSH Login several methods Upgrade tutorial shell script Automation

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 (

Shell variable setting and display

[Root @ localhost ~] # Echo $ {mail}/Var/spool/mail/root[Root @ localhost ~] # Echo $ {mail ###/*/} # pre-Greedy match DeletionRoot[Root @ localhost ~] # Echo $ {mail #/*/} # pre-match DeletionSpool/mail/root[Root @ localhost ~] # Echo $ {mail %/*} #

Linux Shell WC command

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

Linux Shell advanced skills (3)

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

Zenity: Add shell to graphical interface

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

Issue of self-starting shell by WinCE

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

Automatically run shell in the background

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

How to debug Linux shell scripts

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

The shell script automatically restarted after the monitoring process crashes in linux

========================================================== ========== 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-

Use SharpShell to quickly implement Windows Shell Extension

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

Total Pages: 541 1 .... 307 308 309 310 311 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.