Shell, switch user, execute specified, script

In some cases, such as Oracle, you must switch to the specified user to restart Oracle.Each time the manual operation is more troublesome, you can write a script.The function of automatically entering password, need to use expectInstall firstYum

Linux Shell Digital Computing

Directly on the script,Use $ (()) and $[] for numeric calculationsNumerical comparison:N1-eq n2 Check if N1 equals N2 n1-le n2 check N1 is less than or equal to N2N1-ge n2 Check if N1 is greater than or equal to N2 n1-lt n2 check N1 is less than N2N1

Shell script usage Record

Some of the more functional requirements are relatively simple to consider using the shell script to write, so as to facilitate fast and stable1. Read the file value, open and close some programs according to the file value 1 or.A. While:DoDoneis an

Linux shell Programming (ii) Condition testing

There are three types of conditions that are commonly tested in bashConditional test expression: [expression] [[expression]]First: Integer test:-eq tests whether two integers are equal, such as [$A-eq $B]-ne test two integers in different sizes-GT

Special variables in the shell

$ represents the current process when using the Echo $$ is the PID that will output the current shell1 Echo $$ List of special variables variables meaning $ File name of the current script

Shell batch multiple server data copy

Experiment Server Two:192.168.77.189192.168.77.190 Server-free key login settings:[email protected]_168_77_189 ~]# Ssh-keygenGenerating public/private RSA key pair.Enter file in which to save the key (/ROOT/.SSH/ID_RSA):Enter passphrase (empty for

Use of variables in the shell

1. Declaration of variablesName= "Blacksonny" Note://variable definition does not add $, the variable and equal sign cannot have spaces betweenVariable naming rules: The first character must be a letter (a-z,a-z). You can use an

In the shell, we can use $ A, $, $, $ ... This variable extracts the variables in the command line

Code: Script_name parameter1 parameter2 Parameter3 ...It's easy to guess that the $ A is the shell script name (path) itself, and $ $ is the first argument, and so on .... you have to pay attention to the role of IFS, that is, if IFS is quoting,

Replacement in the shell

If there are some special characters in the shell, you need to replace them, you can do command substitution, variable substitution, escape substitution1. Substitution of escape charactersThe shell contains the following transfer characters\a Bell

Shell Script notes (the original is constantly recorded)

Start your own shell script practice today, just as the company has too servers, to time the data of the CP is monthly:Consider: First look for the law, found all placed in the/opt/www/aaa/there are a lot of 2 level and 3 levels of directories and

Monitoring of shell scripts specifies the running state of a process

In the previous blog, the implementation of the automated test program was written, and now the developer needs to know the running state of the process that was tested (in this case, the main process running on Linux) before the exception exited,

Shell Learning Path: Process Control (for)

Syntax for the FOR loop:1. For variable in value 1 value 2 value 3 ....DoProgramDoneFor example: The following script will print 4 times respectively the value of morning noon afternoon evening1 #!/bin/bash2#打印时间 3#Author mrfeng45 for-time in

Shell Learning Path: Process Control (IF)

1. Single-branch if condition statement1 if [conditional judgment type]; Then 2 program 3fi4 or 5if [conditional judgment]6 then 7 program 8fiPrecautions:The 1.if statement uses the fi end, and the general language uses curly

Shell Script [op-expression, conditional-control statement]

#!/bin/bash#你值得收藏的四则表达式运算. val1=1Val2=1val3=1val4=1val5=1val6=1val7=1 Letval1++ ((val2++)) val3=$ (($val 3+1)) val4= ' expr$val 4+1' Val5= ' bc$val 5+1' Val6= 'Echo "$val 6+1"|BC ' val7=$[$val 7+1]Echo ' val1= ' $val 1Echo ' val2= ' $val 2Echo ' val3

Shell creation functions and reference functions

Typically, when you write a shell script, you'll find that the same piece of code is used in multiple places. It doesn't matter if it's just a small piece of code. But it's hard to rewrite chunks of code multiple times in a shell script. The bash

The regular expression of shell programming

Regular expressions are primarily a grammar rule used to describe character permutations and matching patterns. It is mainly used for the pattern segmentation, matching, finding and substitution of strings, the main purpose is to match.Wildcard

Shell Review---File decompression command

Need to deploy the server itself, so after the application of space, you need to install Linux itself, install Apache, etc., so download the compressed file needs to run. On the internet to find some decompression command wrong, especially try the

Shell Run Java/jar Script

1.Shell Execute/Invoke Java/jar program#!/bin/bashjava_home= "$HOME/jdk" base_dir= ' dirname "if [" $BASE _dir "= '. ') Then base_dir= ' pwd ' fiprocess_home= ' dirname $BASE _dir ' my_dir= ' $PROCESS _home/gasarchiveprocess "run_dir=" $MY _dir/

Array of shell scripts

Array:A collection of a bunch of variables.Statement:Declare-a ArraynnameEach of these variables is Arrayname[index]Index starts from 0.Assignment value:Arrayname[index] = VALUEArrayname = (VALUE1 VALUE2 ...)Arrayname = ([index1]=value1

/Etc/profile and/etc/bashrc, interactive and non-interactive, the difference between login and non-login shell, bashrcnon-login

/Etc/profile and/etc/bashrc, interactive and non-interactive, the difference between login and non-login shell, bashrcnon-loginThe online memcached crashes again and still does not get the core file. Check the cause and find that the script for

Total Pages: 541 1 .... 379 380 381 382 383 .... 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.