Notes on Linux shell programming

Advanced Features of If-then  [[]], [] are used to test (test is divided into numeric comparisons, string comparisons, file parity),[[]] is a keyword , which can be used &&, | |, and other similar C language syntax ; [] is a command that is

Shell scripts pass parameters with spaces

In another blog "shell script implementation DB2 database table export to file " implemented through the implementation of the script to export the DB2 database to a file, need to pass in seven parameters, the last is a string with a space, so when

Get time in the shell as a directory format

Recently wrote a small program that takes time to traverse as part of a directory#!/bin/bashfor i in {1..30}dodate= ' date +%y/%m/%d-d "$i days Ago" ' Echo $datedoneFor loop, take the date of the last n days.The core isDate= ' Date +%y/%m/%d-d ' $i

The experience of Shell scripting in development

The experience of Shell scripting in developmentThis period of time in the development of a program, program output has a lot of logs. Sometimes you need to log to analyze the problem of the error. Separate viewing efficiency is too low to analyze

First shell script

Open a text editor, create a new file, the extension sh (sh for Shell), the extension does not affect the execution of the script, see the name is good, if you write a shell script in PHP, the extension is good with PHP.Enter some

Shell Basics (ix) function

function allows us to divide a complex function into several modules, which makes the program structure clearer and the code reuse more efficient. Like other programming languages, the Shell supports functions as well. The Shell function must first

Description of case command in Shell under Linux (regular break, unconditional continuation and conditional continuation)

The case name in the shell under Linux is similar to the switch in C + +, but cases in the shell are more powerful and complex.1, strong mainly reflected in: Shell in case the keyword can be a string type, and each item can contain regular

Shell text filtering programming (11): paste command

Tag: script [Copyright statement: reprinted. Please retain the Source: blog.csdn.net/gentleliu. Mail: shallnew at 163 dot com]It can be seen from the literal that the paste command and the cut command have the opposite function. The cut command

Method for obtaining the process ID by shell: pidof | pgrep | PS-A + grep + awk

Method for obtaining the process ID by shell: I know there are three things I have learned and practiced: PS-A | grep "cmdname" | awk '{print $1 }' Pidof "parameter name" Pgrep "cmdname" The three running results in bash and busybox ash

Shell upgrade,/bin/bash versions 4.1 to 4.3

Bash environment variables have arbitrary code execution vulnerability: "Using CGI requests can cause remote code execution, which in turn leads to server intrusion, causing serious harm,Patches officially announced are also

Zabbix automatically installs server (Shell)

#!/bin/bashDBUSER=‘root‘DBPASS=‘‘DBHOST=‘localhost‘ZBX_VER=‘2.0.1‘function checkReturn {  if [ $1 -ne 0 ]; then     echo "fail: $2"     echo "$3"     exit  else     echo "pass: $2"  fi  sleep 3}cat  /dev/null  /tmp/mytmp393; mv /tmp/mytmp393 /etc/zab

Hadoop shell command Dictionary (available for favorites)

You can read the following questions:1. What is the difference between CHMOD and chown?2. Where does cat output the content of the specified file in the path?3. Can CP be replicated between different types?4. How can I view the file size in HDFS?5.

Peid off-pecompact shell 0 basic practice

Recently, I sent a peid shell check tool to everyone. Maybe the newbie doesn't know what this is.Let's take a look at its usage.Peid is now the most popular shell check tool. The so-called "shell" is to put a "shield" on the program, which can be

Shell-z-D and so on

1234567891011121314151617181920212223242526272829303132 [ -a FILE ] IfFILE If yes, it is true.[ -b FILE ] IfFILE If the object exists and is a special file, it is true.[ -c FILE ] IfFILE If a special file exists and is a word, it is

Shell tutorial 6-shell comments

The line starting with "#" is a comment and will be ignored by the interpreter. Sh does not contain comments from multiple lines. Only one # sign can be added to each line. It can only be like this: # ------------------------------------------ #

Shell tutorial 5-shell Operators

Bash supports many operators, including Arithmetic Operators, Relational operators, boolean operators, string operators, and file test operators. Native Bash does not support simple mathematical operations, but can be implemented using other

Write shell chgrp, chown, chmod by yourself

1. chgrp implementation #include #include void chgrp(char * groupname,char * filename){ struct group * groupinfo = NULL; if((groupinfo = getgrnam(groupname)) == NULL) { printf("groupname does not exist\n"); return; } if(

Shell tutorial 4-shell replacement

If the expression contains special characters, shell will replace it. For example, using variables in double quotes is a replacement, and escape characters are also a replacement.For example: Copy text-only new window  #! /Bin/bash   A = 10

Getting started with Shell programming (version 2) (I)

Getting started with Shell programming (version 2) (I)Simple example Shell program Example 1. #!/bin/bash#This is to show what a shell script looks likeecho "Our first example"echo # This inserts an empty line in output.echo "We are currently in the

Linux shell redirection and shell redirection

Linux shell redirection and shell redirection Redirects the shell error output to the standard output to record the error information of the script. For example: /Root/test. sh> test. log 2> & 1 Note: Linux first loads/etc/rc. d/rc. local

Total Pages: 541 1 .... 321 322 323 324 325 .... 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.