Shell Script Learning 1 (Linux script Raiders)

sudo equivalent to root permission execution commandGive executable permissions to all user files: chmod a+x script.shExecute script:./script.sh#./represents the current directoryCommand 1:echo "Welcome to Bash"Command 2:printf "Hello

Shell Simple Introduction (i)

Reading slow, easy to forget, on the Internet to find examples to do, pondering the examples do not understand, and then continue to Baidu.The importance of shell scripts under Linux is not much to say. Starting with the first example:#!/bin/"Hello

Practice of shell Special extended variables

Bo main name: Li ChangmingBlog Address: http://keep88.blog.51cto.comThis note is from the old boy books: Learn Linux OPS Shell programming with old boysSpecial extension variables1. ${parameter:-word} Functional PracticeThe role of ${parameter:-word}

Basic usage of the shell

One: Shell introduction1. What is a shellThe Shell's Chinese meaning is "shell," in layman's words, the shell is an interactive programming interface that uses the user input to drive the operating system kernel to complete the specified work. In

Pytohn implementing the WC command in the Linux shell

#!/usr/bin/pythonimport sysimport osfrom optparse import optionparser  def  opt ():     parser = optionparser ()     parser.add_option ("-C",  "--char",                       dest= "Chars",                       action= "Store_true",                 

Shell programming for Linux systems-the normal form

Shell programming is in the form of:1: meta-character []. *  ?+ ( )  | {  }  ^  $2: [a-z0-9] Represents a random number and letter match3: [^a-z] matches the random one except the letter4:ab+c + represents a character that matches one or more of the

Shell Knowledge points

Alias creating aliasesUnalias Deleting aliasestype [name] to see if it is an internal or external commandenv lists all environment variables and their contents in the current shell environmentset to observe all variables in the current shell

Shell Foundation Part2

Shell BasicsFirst, the variables in bash1, the definition of the variable: The variable is the memory unit of the computer, where the stored value can be changed.2, the variable's setting rule: The variable name cannot begin with the number, the

Shell Implements simple calculator function

The Shell implements a simple calculator function with the following script:[[email protected] scripts]# Cat Jisuan.sh#!/bin/bashprint_usage () {printf $ "usage:$0 NUM1 {+|-|*|/} num2\n" Exit 1} #判断传入的参数是不是3个if [$#-ne 3] then print_usagefifirstnum=$1

Shell's sed command to delete a variable with a "date time and so on" method

Shell's sed command to delete a variable with a "date time and so on" methodThe SED command deletes the specified content and may be known, for example, if you want to delete the line containing "Badboy" in a file, use the following command directly:

Shell Cut Log Script

Vi/etc/logrotate.d/nginx #编辑脚本/usr/local/nginx/logs/*.log/usr/local/nginx/logs/nginx_logs/*.log{Missingok # ignores errors, such as "log file cannot be found" error message. Dateext # The log file after the switch is appended with the date of the

Shell output 100 + summary of methods

Python-c "Print (' + ' *100)"Head-c 100/dev/zero |awk ' gsub (/./, "+") 'Perl-le "Print (q (+) x100)"println ("+" *100)method to output 50 x = echo "" | Sed ': A; s/^/=/; /=\{50\}/b; Ta Sed ': A;s/^.\{0,49\}$/&=/;ta ' awk '

Shell Basic Learning

#! /bin/bash#设置只读变量, read-only variables are not modifiableMyurl= "Http://www.baidu.com"ReadOnly Myurl#删除变量, unset cannot delete read-only variablesmyurl1= "Http://www.sina.com"Unset MYURL1#运行shell时会同时存在三种变量#局部变量, environment variables, shell

Use of the Shell's read

The read command is used to receive input from the keyboard's standard input and other files, and after the input is entered, the Read command places the data in a standard variable.Example 1:#!/bin/bashRead-s-P "Enter you password:" Password #-s:

The method of generating random numbers in Shell series

One: RANDOMEcho $RANDOMRandom number is a range of 1--32767, generally used it can be cracked1.2 Generate a eight-digit random password:echo $ (($RANDOM +11111111))Two: Md5sum random encryption method generates a longer passwordTake 9-digit password:

Centos Execution Shell command returns 127 error

Shell Scripting Features:Connect MySQL, create the database automatically, the script is as followsMysql-h$mysql_ip-u$mysql_user-p$mysql_password--default-character-set=utf8-e "CREATE database IF not EXISTS test"Database IP, user, password using

Learn the shell script

First line: #!/bin/bash--#! Interpreter for Tag scriptScript: #!/bin/bashecho "Hello World"Give execute permission chmod +x./test.shExecute script:./test.shThe $ symbol is not required when defining a variable: td= ' Date ' +%y%m%d '1. There can be

My shell script programming

For Shell scripting features it isProgramming languages, script type languages, interpreted languages.There are always three execution structures to follow when writing scripts: sequential execution of structures, selection of execution structures,

Shell comparison of floating-point numbers and integers

Today, a friend suddenly asked me in the shell, how to compare floating point and integer, but I asked a Leng, in the work did not encounter this scene. We also know that the calculation of numbers in the shell is usually converted to integers, such

Linux Shell cat Commands

Cat: View the contents of a file, connect a file, create one or more files, and redirect output to a terminal or file usage: cat [options] [file]1. $ Cat Hello.txtdisplaying content in a hello.txt text file2. $ cat-n File-N option to display the

Total Pages: 541 1 .... 345 346 347 348 349 .... 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.