The practice of Shell programming is genuine (code example)

1, in any folder, create a new 10 empty files, the file name is T1.txt-t10.txt, the file content is 11-20, on a line, and then the 10 files named as t1.sh-t10.sh.Old driver Version:$ for ((i=1;i> "T" ${i}.txt; Done #创建加写入$ for fie in ' ls *txt ';d o

Logical judgments in shell scripts, file directory attribute judgments, if special usage, case judgments

Logical judgment in the shellFormat 1:if condition; Then statement; FiIf it's what it is, then what happens?Write a simple script that means when a=5, when a is greater than 3 o'clock print OK#!/bin/bashA=5If [$a-GT 3]ThenEcho OKFiExecute script

Shell Programming Awk Basics Introduction

awk IntroductionReport Generator, formatted text outputThe processing mechanism is similar to the SED command, which comes with loop processing, reads a line and then automatically reads the next line to processThe identity of the SED command

2018.4.21 Five week fourth class (Shell special symbol, cut intercept and other commands)

Shell Special Symbol _cut command概念:cut命令用来截取某一个字段格式:cut -d ‘分割字符‘ [-cf] n,这里的n是数字,该命令选项有如下几个:- d 后面跟分割字符,分割字符要用单引号括起来- c 后面接的是第几个字符- f 后面接的是第几个区块The Cut command uses the following [Email protected] do]# cat/etc/passwd

Shell Introduction Command history command completion and alias input output redirection

Shell IntroductionThe shell is a command interpreter that provides interaction between the user and the machineFor example, we have remote login tool, it is actually a shellThe CentOS default shell is bash (Bourne Agin Shell)·Command historyHistory

Shell script structure, date command, variable

20.1 Shell IntroductionShell is a scripting languageYou can use logical judgments, loops, and other syntaxCustomizable functionsThe shell is a collection of system commandsShell scripts enable automated operations, which can greatly increase our

Shell output color and flicker control

Shell Color and Flicker control Sometimes custom output is required under the shell, such as adding color to the output, highlighting it, or adding flicker.Then these color codes or control codes are relatively bad to remember. At this

Shell monitors whether automatic backups are successful (determine if files exist)

Once the backup SQL file is generated in auto-package, monitor the operation!#Crontab Time # variablesfile_dir=/data/mysql_bak/ #备份存放路径DATE = ' Date +%y_%m_%d ' #获取当前系统时间FILE_NAME = " Mysqldata_bak_$date.tar.gz "#最终保存的数据库备份文件名FILE =${file_dir}

Shell Basics: Introduction, historical commands, command incomplete and aliases, wildcard characters, input and input redirection, plumbing and job control

 Introduction to the Shellzsh, ksh (yum list |grep zsh to be viewed and then installed accordingly )Command history1./root/.bash_history (this file holds the command we've knocked on)2. History (You can see how many of the commands we've used before.

A script to understand the meaning of positional parameters in a shell script

#!/bin/bashEcho ' $ "gets the currently executing shell script file name: '" $ "Echo ' $n gets the nth parameter value of the currently executing shell script, n=1..9 ' $ ' =$1, ' $ $ ' =$2, ' $ $ ' =$3Echo ' $get all parameters for the current

Writing a shell script--writing a simple script

1. Simple script file hello.sh, the content is as follows#!/bin/bashpwdls-alExecute script: Bash hello.sh or use the root command:./hello.sh2. Accept user ParametersThe name of the script file executed by $ A$* on behalf of all user parameters$?

Shell special symbol, cut, sort, WC, uniq, tee, TR, split command

* Represents 0 or more arbitrary characters[[email protected] ~]# ls *txt11.txt 1.txt 22.txt 2.txt aa.txt a.txt? Represents only one arbitrary characterWhether it's a number or a letter, as long as it matches a single character.[email protected] ~]#

Shell Programming Basics

When it comes to programming, we are all not unfamiliar, but in Linux, we mainly do script writing. Of course, in order to understand the scripting of Linux, we have to first say the logical relationship of multi-command execution.1. Command

Detecting memory leaks in your application (shell)

Write code--debug--fix bugChange to change there may still be some problems that are not found, when the project volume is more prone to occur, such as memory leaks such problems, serious impact on system performance.There are some tools on the

Linux Server System load monitoring-shell script

One, monitoring server system load situation:1, use the uptime command to view the current load situation (1 minutes, 5 minutes, 15 minutes average load situation)# uptime15:43:59 up 186 days, 20:04, 1 user, load average:0.01, 0.02, 0.00Rule of

Vertical bars in the Linux Shell (|)--Pipe symbols

Pipe symbol, UNIX is a very powerful feature, the symbol is a vertical line: "|".Usage: Command 1 | Command 2 His function is to pass the result of the first command 1 execution as input of the Command2 to command 2, for example: $ls-S|SORT-NR (Note

4 ways to execute shell scripts in Linux summary

Article Source: http://www.jb51.net/article/53924.htmThis article mainly introduces the 4 methods of executing shell scripts in Linux, that is, 4 ways to run shell scripts in Linux, and the friends you need can refer to the followingThere are

Shell error: Syntax error:unexpected end of File

Tagged with: Expect test shell strong analog Linu display binary comSometimes the script is executed with an error:SH -x test. SH + $'\ r': Command not foundtest. SH Panax Notoginseng fileThe reasons may be:Text editing is a file written in Notepad

Linux shell online text editing sed

sed command file editingsed is a text editing command that reads file data through a terminal into a buffer, then edits text through SED, and in the output to the specified file, sed is a stream editor, which is a very useful tool in text processing,

The way of Learning (iv): Shell weak type programming language and script syntax

编程能力:脚本编程 编程语言:机器语言、汇编语言、高级语言 静态语言:(编译型)C语言 C++ JAVA C# 动态语言:(边解释边执行) 面向过程:shell C语言 面向对象:JAVA Python perl C++ Shell weakly typed programming language strong: When variables are used, they must be declared in advance, or even

Total Pages: 541 1 .... 101 102 103 104 105 .... 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.