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
I often see 1> & 2 similar statements in Linux shell scripts. What does this mean?
In fact, both of them are Linux file descriptors. in Linux
0 indicates standard input.
1 indicates standard output
2 indicates error output
Another special one
Variables can be used in makefile by $ (VAR) or $ {var}. For details, refer:
Http://blog.csdn.net/lovetangtang/archive/2005/12/31/567297.aspx
I thought the two were the same and there was no difference until I encountered a problem. Because of
1. First look at a common command
PS-EDF | sort | uniq | grep-V sh | more
This command combines several different shell commands, which have this feature. Uniformity and simplicity.
You can use pipeline commands to combine multiple shell
Enter the following command to understand the shell currently logged on:
$ Echo $ Shell
/Bin/bash
The system uses bash shell. There are many other shells. You only need to enter the new shell command (Ksh, tcsh, CSH, sh, Bash, etc.) in the
Linux Shell is a powerful script program with simple syntax. The following is an executable sh script, covering common shell syntax and usage. Understanding it is equivalent to getting started.
#! /Bin/bash# Title:# Date :?# Author: Made by
1. Shift remove the first parameter
2. $ # provides the total number of parameters passed to shell scripts or functions.While [$ #! = 0] gradually decreases with shift $ #, And the loop ends.DoCase $1 in
EsacShiftDone
3. $ *, $ @All command line
In Linux Shell, you can define functions and call them in shell scripts. The following describes the definition method and the precautions for calling it.
1. Define the shell function (define function)
Syntax:
[Function] funname [()]
{
Action;
A custom net function is used to capture the IP address, netmask, and broadcast information of the network adapter from the ifconfig output result.
##ip netmask broadcastfunction net(){ name=$1 num=\$$2 /sbin/ifconfig -a | awk '
In shell scripts, you often need to obtain the system time to process an operation. Today, the system learns how to obtain the system time. The record is as follows:
Linux system time can directly call system variables in shell, for example:Get the
1.Test File status
Table 1 File status test
-D directory-s file length is greater than 0, not empty-F: regular file-L symbolic connection-R readable-x executable
-S file length is greater than 0, not empty-W writable-The U file has
Send mail using msmtp mutt Shell
1. Compile the software.
Software: http://sourceforge.net/projects/msmtp/files/msmtp/1.4.13/msmtp-1.4.13.tar.bz2/download
Tar jxvf msmtp-1.4.13.tar.bz2
./Configure -- prefix =/opt/msmtp
Make
Make install
2. Check
Http://blog.csdn.net/zmxj/archive/2009/02/25/3937372.aspx
The wscript. Shell object provides the run and exec methods. Recently, the project needs to use pscp In VBScript to copy files from the Linux server. The exec method is used. The following
This is the first thing I did in my company that is directly related to programming and requires shell commands. In fact, I feel that the shell under Linux is the same as the DOS batch processing under windows.
Question:
1. Use the shell language
Curl is a URL access tool that can be used to construct HTTP request packets and parse the HTTP response returned by the server. It also supports cookie features and can be used to complete basic web browser functions. Curl also supports https, FTP,
Question:
1.Extract the rows that contain "warning" or "Fatal" and do not contain "ignor" from the. log file, and then extract the 5th fields separated ":".
2.Write a script and only want to perform simple subtraction. A prompt is required to enter
Shell commands: Common commands and built-in commands.
External commands: commands that can be executed at the command prompt.
Built-in commands: Implemented in shell, cannot be called as an external program.
The internal or external commands are
This article is reproduced in: http://blog.sina.com.cn/s/blog_674b5aae0100o2mn.html
BASH Shell has four arithmetic operations:1: Use expr external program
Addition r = 'expr 4 + 5'Echo $ RNote!
4 + 5 there must be gaps between the three
'Expr 4 + 5
Questions about using shell variables in awk
Author: swysn published at: 2002/03/22 05:01 pm
[This post was last edited by Valentine at]2002/01/011312 32132 AA 32132131#! /Bin/shEcho "Enter :"Read
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.