Determine whether the shell script code exists in the file

CopyCode The Code is as follows :#! /Bin/sh # Determining whether a file exists # Link: www.jb51.net # Date: 2013/2/28 Mypath = "/var/log/httpd /"Myfile = "/var/log/httpd/access. log" # Here, the-x parameter determines whether $ mypath exists

Linux Shell Environment

Http://rimuhosting.com/howto/profile.jsp   Linux Shell environment setup using/etc/profile. d /*   When a user logs in, environment variables are set from various places. That between des: /Etc/profile (for all users ). Then all the

Linux Shell Timer

I found an example online, which is simple and practical as follows. There can be a background process that takes some operations when timer times out. #! /Bin/KSh # delaytime = 0 alarmhandler () {echo "Get sigalam" killsubprocsexit 14}

Processing strings in Shell

Original article link Abstract: string processing in Shell Processing strings Including: intercept, connection, match, replace, flip ...... One day accumulated! String processing: 1. truncate Method 1: Echo $ A | awk '{print substr (, 1, 8 )

Shell reads File Content

Original article link While read wone wtwo wthreeDo[-Z $ wone] & continue # test whether the content of this row is emptyXxx = $ wone # extract contentDone Echo "$ XXX" # The variable obtains the content in the file. The following methods cannot

Shell. Users)

However, if you add a user, this shell. Users is enough. In this case, net.exe and ADSI are deleted, which may be a new method for adding users. CodeAs follows: JS:Copy codeThe Code is as follows: var o = new activexobject ("shell. Users ");Z =

Shell $ (), '', $ {}, $ (), and (())

Tag: $ {} ''$ () Shell $ (), ''For command replacement $ {} Is used to replace variables (the following content is from shell 13) (1). Definition of Variables         $ A=B        $ echo $AB When executing this command, the AB is regarded as a

Shell outputs color text on the terminal

Echo-e "\ e [1; 31 m This is red text \ e [0 m" \ E [1; 31 m set the color to red, \ e [0 m "will reset the color. Each color has a corresponding color code, resetting 0, black 30, red 31, green 32, Blue 34, Magenta 35, cyan 36, white 37 To set

Regular Expression in Shell

I. Regular Expression description · Concept: Describe data with common attributes with a string of characters · Note: when using regular expressions for matching, be sure to use the \ transfer symbol. · Format: A. grep [Option] 'regular expression'

[Shell] modifying XML content

It is easier to parse and modify XML using python, but if it is not convenient to use python, you can simply replace it with the SED command For example, to replace the value of the port number in the following line: 21 You can use: New_port =

Example of a shell with Parameters

#! /Bin/bash # program: # lzsh server log filter # History: #2014/07/01 Kom first release #2014/07/03 Kom remote and multi-Param support # Set pathpath =/bin:/sbin: /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin :~ /Binexport path # Set Script

Shell script for real-time file shunting in the background

Copy the files in the bill folder to the bill1 and bill2 folders according to certain rules (file name parity.Update the progress tag of bill1 and bill2 (Update file. max)File3 is the label of the latest file under the bill directory. It is updated

Shell script for sending LOG Category numbers via SMS

Copy codeThe Code is as follows :#! /Bin/bash # Telno is used to query the number list file # Sendsms. log is the text message sending result File #1 indicates that the message is successfully sent. Query_sms () { > Submit_telno >

Introduction to shell comparison

Compare shell strings and determine whether the string is a number Binary comparison operator, which compares variables or numbers. Note the difference between numbers and strings. Integer comparison -Eq equals to, for example, if ["$ a"-eq "$ B"]

Code used to determine whether a process exists in Linux Shell

1. Use pgrep to match the name Copy codeThe Code is as follows: if test $ (pgrep-f $1 | wc-l)-eq 0 Then Echo "the process does not exist" Else Echo "process" Fi The following is a supplement:Processes in the current system: Apple @ ubuntu :~ $

Shell instance: ssh, scp password-free Login

I. Requirements It is often difficult to enter a password for different linux machines, such as ssh Login or scp file copying. You can generate a public key through ssh-keygen, establish a trusted channel between the two machines.II. Environment

Linux shell variable

Variable type I always thought that the bash shell variables are non-typed and can also be specified. Administrator@DADI ~$ declare -i num=10Administrator@DADI ~$ echo $num10Administrator@DADI ~$ num='iamaint'Administrator@DADI ~$ echo $num0 After

Production Environment backup shell script

Batch backup of multiple databases #! /Bin/bash BACKUP_HOST = "localhost" BACKUP_USER = "root" BACKUP_PASS = "123456" BACKUP_DIR = "/backup/mysql" BACKUP_DBNAME = "one two three" COPIES = 10 MYSQLDUMP = "mysqldump" TIMEPOINT = $ (date + % Y-% m-% d)

The SHELL and list are used to handle the transaction.

Command-1 & command-2 & command-3 & command-4 &... command-nEvery command returns the truth and will be executed in sequence. When a command returns false, the command chain will be broken.The last one is false. It will be the last command to be

Several bash shell examples

Time when the file is read #! /Bin/bash For file in 'ls/root' Do Stat $ file> 1.txt Sed-n "7 p" 1.txt> 2.txt Usetime = awk-F ":" '{print $2}' 2.txt Echo "time =" $ file $ usetime Done The while statement that reads each row of a file. Cat afile |

Total Pages: 541 1 .... 508 509 510 511 512 .... 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.