1.export commandThe Linux Export command is used to set or display environment variables.When executing a program in the shell, the shell provides a set of environment variables. Export can add, modify, or delete environment variables for use by
Prerequisite: Configure your own machine ssh password-free login#!/bin/bashCat list1234EODWhile Read lineDoif SSH [email protected] "test-f/tmp/a.sh"; Then #配置了免密登录, no password is entered hereecho "$line file exist."Elseecho "$line file not exist."
Bash Digital Computing--Digital processing power is critical for any programming language, but for bash shell scripts, this ability is poor, even if the form of Expr command and $[] can only be used for integer operations, the operation of
First, let's start by saying what the shell timestamp is:The number of seconds since January 1, 1970 (00:00:00 utc/gmt). It is also known as the Unix timestamp (Unix timestam, Unix epoch, POSIX time, Unix timestamp) is the number of seconds that
Two Methods for calling/referencing/containing another script file in Shell
Script first (test example 1)
1
#! /Bin/bash
2
Echo
'Your are in first file'
Q) is another script file called in the current script file?
Method 1: Use source
Cainiao help: How to call other software in shell-Linux general technology-Linux programming and kernel information, the following is a detailed description. This is my own small program. uvfit is a task of the miriad software. It is executed with
Origin: in the shell programming teaching conducted by old boys in Linux training, many well-experienced netizens and students are still confused about arrays. The following is a small example of array usage, hope to help you. In fact, the shell
Reference address:
The information returned by ifconfig includes the IP address, but it is troublesome to obtain the current IP address in shell.
Obtain Method
The formats of ifconfig returned information vary in different systems:[1]
Linux:
1. For Loop statementsBasic for loop of instance 1.1
#! /Bin/bash
For X in one two three fourDoEcho number $ xDone
Note: A "for" loop always receives a certain type of word list after the "in" statement. In this example, four English words are
Tag: Shell
In Shell, some symbols are processed differently under different definitions. There are three main methods to define them:
(1) single quotes
(2) double quotation marks
(3) reverse quotation marks
Double quotation marks and single
1. Event Description:
1 ,#! /Bin/bash
Cat ../ip.txt | while read line
Do
Echo $ line
SSH $ line "ls"
Done
The result is recycled once and then exited. The reason is that while uses the redirection mechanism. All the information in the file is read
Use 'grep' to search for text files
If you want to find a string in several text files, you can use the 'grep' command. 'Grep' searches for the specified string in the text. For example, if you are searching for a file with the string 'Magic 'in the'
In Bash, you can use the following three methods to process command lines:ParametersEach method has its own application scenario.1. perform direct processing, parse $1, $2,..., $ N in sequence, and perform manual processing respectively;2. getopts
Call another script in shell script
Bash shell commands are divided into two types: External commands and Internal commands. External commands are implemented through system calls or independent programs, such as SED and awk. Internal commands are
The while LOOP trap and shellwhile trap in shell
When writing A while LOOP, I found a problem. In the while LOOP, I assigned values to variables, Defined variables, array definitions, and other environments, and the environment became invalid
The if else statement in Shell shows how to learn little shell quietly. Today we can see if else Hello ~ The following script is used to judge the parameters of the script executed by the user. If it is hello, it will show how are you. If there is
This problem was discovered when the SGE startmpi. Sh script was transformed. Consider the following shell code:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#! /Bin/sh
# Declare-I
Testline =
Summary: three methods of executing shell scripts, fork, source and exec, are summarized.
Prerequisites
1. any program we run is a child process generated by the parent process. After the child process is completed, it is returned to the parent
Create an unzipped installation package in Shell
Principles
In Linux, you can use several basic commands to create a self-extracting program. The principle is: The Cat command can be used to connect two files (with> append can achieve the same
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.