Shell conditions and tests

Classification ReferenceFile Status Test -B filename Returns True when filename exists and is a block file (returns 0) -C filename Returns True when filename exists and is a character file -D

Shell script, a shell start-up process.

#一个shell的启动流程 #shell have some variables, called environment variables, which can be inherited, #比如父shell有 $UID, child shells can have, and inherit the parent shell. #正常我们声明一个变量, a=1, in the child shell, A is empty, and the variable declared by

Shell script, how to implement every time a new shell is opened to output a prompt?

[Email protected] wyb]#CatTest.SH Echo-E"\033[32mhello,this is Wangyuebo ' s shell\033[0m"Echo-E"\033[32m ' Date ' \033[0m"LANG=enEcho-E"\033[32m ' Date ' login at ' hostname ' W ' \033[0m">>/etc/Wangyuebo.log[[email protected] wyb]# when the cue is

Linux shell switching

View System available Shell types: (typically bash shell)? ~ Chsh-l/bin/sh/bin/bash/sbin/nologin/bin/Dash/bin/zshTo modify the current shell:[[email protected] ~]# Chsh-l/bin/sh/bin/bash/sbin/nologin/bin/Dash /bin/~ for root. New Shell [/bin/bash]:/

Use of shell variables

Reprint please indicate http://www.cnblogs.com/winifred-tang94/There are three types of variables in the shell environment:A, environment variables; You can refer directly to the shell script in the form of "environment variable name".b,

Shell's underlying syntax

Shell variables: Local variables and environment variablesBasic elements:#! /bin/bash#VariableProcess ControlHome: The current user's home directoryPath: The current user's executable file search pathLANG: The default language the program should

Zookeeper under the shell operation

Zookeeper under the shell operationEnter%zk_home%/binperform zkcli.sh [-server Ip:port] #如不指定, then connect the nativeCreate:create [-S] [-e] path data ACL #创建数据节点-----s indicates that the sequential node-e represents a temporary node, and two are

Shell Script-Regular expression

character class (Character Class): The above example x and y, which represent one character in the pattern , but the range of values is a class of wordsAny one of them.Quantity Qualifier (quantifier): each part of a mail address can have one or

Eval in the shell

Eval syntaxEval arg1 arg2 ...The function of Eval is to take the following parameters Arg1 Arg2 and so on as a pipeline, and then re-execute the shell process pipeline (about pipeline, see http://www.cnblogs.com/chaoguo1234 /p/5724321.html)Suppose

Choose login SSH using shell scripting custom implementation

Create two scripts in the system bin directory, respectively, Pssh tsshPssh#!/usr/bin/expect-fSet IP [lindex$argv 0]set Port [lindex$argv 1]set Password [lindex$argv 2]set TimeoutTenspawn ssh [email protected]$ip-P$portExpect {"*yes/no"{Send "yes\r";

Shell Programming while

Script Programming:Sequential structureSelect structureIfCaseLoop structureForWhileUntilWhile loop: For scenarios where the number of cycles is unknown, exit conditions are neededGrammar:While CONDITION; DoStatement...Done Calculates the and of all

Mu class Network Shell real-combat notes

Shell Footstep Source code:[Email protected]_ecs imooc_shell]$ lscheck_http_log.sh check_nginxserver.sh master_control.sh system_info.shMaster_control.sh: The main control footsteps, other footsteps this script calls##################################

Shell Special Usage

Special usage One whileSyntax Formatwhile read line; DoLoop bodyDone Function: Reads each row in the/path/from/soemfile file sequentially and assigns this line to the line variableExample: Scan a/etc/passwd file for each row, if the Discovery gecos

Casing conversion in Shell

There are two ways of doing this:1, with TRExample: uppercase=$ (echo $VARIABLE | tr ' [A-z] ' [A-z] ') (convert VARIABLE lowercase to uppercase)lowercase=$ (echo $VARIABLE | tr ' [A-z] ' [A-z] ') (convert VARIABLE uppercase to lowercase)2, with

The progress bar and maximum minimum average under the shell

Progress barC Language progress bar reference my original article blog-> progress barFunction proc () {     i=0      str= '       arr= (' | ')   '/'   '-'   ' \ \ ')      index=0     while [   $i  -le 100 ]     do          printf  "[%-101s][%d%%][%c]

Shell 2 Tetris

      declare -i noar= (1 1 1 1); Br= (1 1 1  1 1 1 1 1 1 1    1 0 0 0 0 0  0 0 0 1    1 0 0 0 0 0 0 0 0  1    1 2 0 0 0 0 0 0 0 1     1 0 3 0 0 0 0 0 0 1    1 0  0 4 4 5 0 0 0 1    1 0 0 0 0  0 0 0 0 1    1 1 1 1 1 1 1 1  1 1) echo  "[][]|" echo  " 

Shell script Programming---statement control in Linux

Overview:Statement control for Shell scripts-There are three processes in the process programming language mentioned earlier:Sequential execution: Executed in the order of a single statement;Select execution: Select execution according to the

9. Shell Environment

• printenv– Print Some or all of the environment variables• set– set shell options• export-Export the environment variables so that the program that is executed later knows.• alias– create command aliases1.shell Environment: The shell maintains a

Shell Exercises 1

Exercise one: Write a script 1. Set the value of the variable file to/etc/passwd 2. Say hello to each user in/etc/passwd, and say what the ID is like: (Hint: line= ' wc-l/etc/passwd |       Cut-d ""-f1 ') Hello,root,your UID is 0. 3. Count the

Shell script Programming-arrays (array)

The difference between an array and a variableVariables: Storing the memory space of a single elementArray: A contiguous memory space that stores multiple elements, equivalent to a collection of multiple variablesArray = array name + indexIndex:

Total Pages: 541 1 .... 421 422 423 424 425 .... 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.