How to cancel redirection in a shell program

/*************************************** ******************************* Author: Samson* Date: 08/18/2012* Test Platform:* GNU Linux version 2.6.29.4* GNU bash, version 4.0.16 (1)-release (i386-redhat-linux-gnu) ************************************

Printf and shell touch

Formatting: printf'print format' actual contentWhat are the characters represented by the value 45?Printf'/x45/N' Note:/xnn is a two-digit number, which can be converted into characters. Introduction to SED and awk tools:You can analyze the

Shell string Truncation

Linux ShellTruncation character variableThe first 8 bits of the signature are as follows:1. expr substr "$ A" 1 82. Echo $ A | awk '{print substr (, 1, 8 )}'3. Echo $ A | cut-c1-84. Echo $5. expr $ :'/(.//).*'6. Echo $ A | dd BS = 1 COUNT = 8 2>/dev/

Common shell script Accumulation

1. Date Get time and date Date = 'date + % Y-% m-% d-% H' Echo $ {date}   2. cron Add a Task Scheduler # Vi/etc/crontab   Crontab task format * *** User task Minute hour, day, month, week, user task Field Description

Automatically switch the shell to delete the small log script

To delete logs, you need to switch the user to specify the directory for deletion. Therefore, you need to determine whether the script can be automatically implemented. The direct su command fails, so telnet to the local machine is used.      

Difference between $ * and $ @ in Shell

Difference between $ * and $ @ in Shell A little bit about $ * and $ @ is also learned by cainiao. $ *All location parameters are used as a word.Note: "$ *" must be referenced.$ @It is synonymous with $ *, but each parameter is an independent ""

Common commands and syntaxes for grep, awk, and sed in Shell

Common grep command syntax 1. Double quotation marks and single quotation marksWhen you input a string parameter in the g r e p command, it is best to enclose it with double quotation marks. For example, "m y s t r I n g ". There are two reasons for

Differences between using source, dot (.) in Linux and using script file names to execute shell scripts

Use source, dot (.) when the shell script is executed, no sub-processes are generated. The shell script runs in the current shell, variables declared in shell scripts are visible in the current shell. When the shell script is directly executed using

Shell practice (1)-awk

Recently, I learned the content of shell script writing and read the script easily. But in fact, there are still some difficulties in hand, so I decided to find some examples to practice, after all, there is a saying that is very good: "I have to

Shell if command parameter description

-B. returns true if the file exists and is a block file.-C: returns true if the file exists and is a character file.-D. If pathname exists and is a directory, true is returned.-E: returns true if the file or directory specified by pathname exists.-F

Shell variable assignment and replacement

1 #! /Bin/bash 2 3 # variable assignment and replacement 4 5 A = 375 6 Hello = $ A 7 8 # --------------------------------------------------------------------- 9 # note that when assigning values, do not have spaces before and after the equal sign. 10

Use of Shell functions

Linux scripts are huge and powerful. Definition: Function Name () // function can be omitted { Command } Call: directly use the function name in the script. Of course, you can also include parameters such Function Name parameters (separated by

Use of shell typeset command

[Reserved] common usage of typeset Http://www.chinaunix.net Author: lonely fire published in: 09:50:34 [Comment] [View Original] [Shell discussion area] [close] Typeset can be

Shell script Nic traffic statistics)

#! /Bin/bashIf [-n "$1"]; thenEth_name = $1ElseEth_name = "eth0"FiI = 0Send_o = 'ifconfig $ eth_name | grep bytes | awk '{print $6}' | awk-F: '{print $2 }''Recv_o = 'ifconfig $ eth_name | grep bytes | awk '{print $2}' | awk-F: '{print $2 }''Send_n =

Create an unzipped installation package in Shell

Create an unzipped installation package in Shell Principles In Linux, you can use several basic commands to create a self-extracting program. The principle is: The Cat command can be used to connect two files (with> append can achieve the same

Find in Linux Shell

Post address: cy158358.cublog.cn    #! /Bin/shcheck_patch () { Test-d $1 Return } # Check whether the path exists Check_patch $2 If [$? -Ne 0] Then Echo "No such path $2" Exit 1 Fiif ["$1" = "name"] Then # Searching for TXT files Echo "--------------

Shell programming (2)

The most important script language in Linux is Bash. I will write this (I will only use this :)). Compared with other development languages (such as C), bash is a relatively simple language, mainly used to write some script code, some batch

Shell programming (2)-Use Find and xargs

1,Find Command OptionsThe f I n d command has many options or expressions. Each option follows a horizontal bar -.-Name: searches for files by file name.-Perm searches for files based on the file permissions.-Prune can use this option to make the f

Shell (6)-command execution sequence

1. Run the &: & command on the left (command 1) To return the true result (0 is returned, and the result is successfully executed), and run the & command on the right (command 2) can be executed; 2. Run |: if | the command on the left (command 1)

Implement a shell script for folder Synchronization

Implement a shell script for folder SynchronizationAlgorithm:   1. First find/pathname-print> filea # Get the full names of all files in the two folders. 2. Compare files. Delete unnecessary files in the folder to be synchronized. Then obtain the

Total Pages: 541 1 .... 414 415 416 417 418 .... 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.