Shell Programming Summary

Because the shell script is used in the project, the system looks at it a bit. Previously, it was a general understanding. Variables: Environment variables, pre-defined variables, positional variables, custom variables. Environment Variables This

If Judgment statement in Shell

If condition test Type: File test, digital test, string testIf statement structure: If ...; Then ...; Fi If ...; Then ...; else ...; Fi Conditional test expression: [Expression]

Shell's Funny commands

1. Monitoring commands (run once every 2 seconds)watch "ls -larth"2. Kill the program with one portsudo fuser -k 8000/tcp3. Limit the memory usage of the following commandsulimit -Sv 1000 # 1000 KBs = 1 MBulimit -Sv unlimited # Remove limit4.

Introduction to Shell Process statement usage

1) Use if, case, readExample 1:#!/bin/bash#读取终端输入的字符Read-p "Please input a number:" NN1= ' echo $n |sed ' s/[0-9]//g '#使用if语句进行判断if [!-Z $n 1]Thenecho "Please input a number."Exit 1elif [$n-lt 0] | | [$n-GT 100]Thenecho "The number Ranger is

The shell script will specify the directory of the first 3 days of the date after the directory is packaged with tar and deleted from the source date directory

#/bin/bashWork_home=/dataOlddata_home= "${work_home}/olddata"Target_day= ' date-d '-3 day "+%f"#打包前3天的日期目录压缩成功后并删除TAR-ZCVF ${olddata_home}/$target _day.tar.gz ${olddata_home}/$target _dayIf [$?-eq 0];thenecho "The $i is Compression success"RM-RF

Linux commands (10)--shell programming one (variables and operators)

The shell is an interface between the user and the system in a Linux system, and it is a high-level programming language, in addition to being the command interpreter. In the Linux command described earlier, the shell appears as a command

The shell command under Linux

First, the basic command1. Immediately shutdown and restart, execute the following command: Shutdown-r now or reboot2. Immediately shutdown, execute the following command: Shutdown-h now or Poweroff3, wait 2 minutes shutdown and restart, execute the

Shell Command Collection

CCat Zdd Browse the contents of a ZDD fileCat Zdd1 Zdd2 Browsing the contents of multiple filesCat-n ZDD Browse the contents of a file Zdd and display line numbersCD back to the start directory, that is, just logged into the system directory, CD

Shell programming-common file handling commands

Touch commandThe touch command is used to create empty files, such as when an application wants a log file to exist before they can write to the data. You can create an empty file with the touch command: touch test1 ;The touch command can also be

Shell script: Several possible ways to produce random passwords

1. Generate a random password (urandom version)#!/bin/bash#author: Tintin (Jacob) #/dev/urandom file is a Linux built-in random device file #cat/dev/urandom can look inside the content, CTRL + C exit View # After viewing the contents of the file,

Shell Join detailed

First paste one, join--helpusage:join [OPTION] ... FILE1 File2for Each pair of the input lines with the identical join fields, write a line tostandard output. thedefault join field is the first, delimitedby whitespace. When FILE1 or FILE2 (not

2 minutes-implementation of the boot-up nginx boot script (Shell article)

How to quickly write a startup script , mainly through the following several1, logical smoothing can be in TXT file, have pseudo code way, form system, List order, then add code in a little bit Determine if the program is running

Shell two number of operations, total three variables

#!/bin/bash# Simple script for two number operations A+ -, altogether three parametersEcho$# #对获取的参数以此判断是否包含 [a-za-Z] Something, if included, to exit. Because numbers add up, not numbers, or subtraction. forI_argsinch "[email protected]" Do

Shell Script Process Control

Shell scripts become used in the process usually requires process control, in general, sequential execution, in the actual use of different situations need to execute different commands, then use the choice to execute such as if, case, sometimes

Shell reads file rows, columns

Cat ${file} | While Read lineDoecho $ LineDone-------------------------------------------While the read line #每次读取aa a row in the. ListDoEcho $LINE #输出每行的信息Done ${file}-------------------------------------------Reads the first and second columns

Conditions and looping statements used in shell scripts

This blog post describes the common conditions and looping statements in shell scripts:Conditional statements:650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/06/B7/wKiom1m8ytPDGg7MAAB1t9_5n8Q866.png-wh_500x0-wm_ 3-wmp_4-s_2860871127.png "

Shell shortcut keys

Shell shortcut keysTry all the CTRL keys in bash and summarize the following (all keys that appear below are CTRL key combinations):1. U K YU remove the previous characters from the cursor (not included)K Delete the next character of the cursor

Shell scripts to manage multiple Tomcat instances

In order to simplify the deployment complexity of Tomcat, the previously individually configured script was presented as a parameter that can be used for multi-tomcat instance management in a stand-alone environment.Where the Deploy feature will

Loops in a shell script

The commonly used loops have a for loop and a while loop. For loop [email protected] sbin]# cat for.sh#! /bin/bashfor i in ' seq 1 5 '; Do Echo $idoneA sequence in the script that seq 1 5 represents from 1 to 5. You can run this

Cow farming learning shell bubble sort

#!/bin/bash############################################################### File Name:/server/scripts/maopaopao.sh# version:v1.0# Author: Cattle Farming# Created time:2017-09-20 19:44:10# Description: Bubble sort# Read Instructions:# 1, read-a

Total Pages: 541 1 .... 293 294 295 296 297 .... 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.