Shell for Loop and array application introduction _linux Shell

Reads a file, assigns each row to an array of variables, and prints it out with a for loop Copy Code code as follows: #!/bin/sh I=1 sum= ' sed-n ' $= ' tmp.txt ' #计算文件的总行数 echo "$SUM" While Read line Todo arr[$i]= "$line"

A shell script that automatically logs on to multiple servers with expect _linux shell

Copy Code code as follows: #!/usr/bin/expect-f Set IPAddress [lindex $ARGV 0] Set passwd [lindex $argv 1] Set Timeout 30 Spawn ssh root@ $ipaddress #expect "Yes/no" #send "YESR" Expect "Password:" Send "$PASSWDR" Expect "]*" Send

Uppercase and lowercase converted shell script code _linux Shell

The following script allows you to convert directories or file uppercase and lowercase letters as follows: Copy Code code as follows: #!/bin/sh #edit by Www.jb51.net # [: Upper:] [A-z] # [: Lower:] [A-z] # [:d igit:] [0-9]

Using Wscript.Shell object to hide the implementation code of the CMD command-line run box _vbs

1. Wscript.Shell (Windows Script Host Runtime Library) is an object, and the corresponding file is C:\WINDOWS\system32\ Wshom.ocx,wscript.shell is a component that the server system will use. Shell is the meaning of "shell", this object can perform

Shell script implements bulk replacement file content _linux Shell

Today colleagues found that the internal server's hard disk space is not enough, there are many backups, I can not delete, and found a 320g hard disk mounted, want to later the shell script backup to the new hard disk, to make room for the old hard

Introduction to the position variables of special variables in shell programming _linux shell

1. Get the file name of the current script, including the path. Copy Code code as follows: #写一个测试脚本 Vim test.sh #内容如下 Dirname$0 Basename$0 #执行一下 bash$ (PWD)/test.sh #输出如下 /home/jane test.sh 2. $n get the

Shell script Implementation Analysis The area where IP resides in the Apache log _linux shell

Components used to query IP addresses Copy Code code as follows: wget http://rfyiamcool.googlecode.com/files/nali-0.1.tar.gz Tar zxvf nali-0.1.tar.gz CD nali-0.1 ./configure && make && make install The steps and Nginx are

Shell script implements Memcache cache hit ratio monitoring _linux shell

The company has several servers running multiple memcached processes, in addition to monitoring their normal telnet, the existence of an instance to monitor their cache hit rate. Alarm for their cache hit rate. There's a Perl written on the web

Linux Nginx log Script _linux Shell

Task ScheduleCrontab-l1 * * * */home/dongnan/sh/split.sh >>/home/dongnan/sh/cron.log 2>& Nginx Logls/var/log/nginx/20130730-access.log.gz 20130801-access.log.gz 20130803-access.log.gz20130730-error.log.gz 20130801-error.log.gz 20130803-error.log.gz2

A detailed approach to shell string interception _linux Shell

The first 8 bits of a character variable are intercepted by the Linux shell, with the following methods: Copy Code code as follows: 1.expr substr "$a" 1 8 2.echo $a |awk ' {print substr (, 1,8)} ' 3.echo $a |cut-c1-8 4.echo $ 5

Shell Script Learning Guide [i] (Arnold Robbins & Nelson h.f Beebe) _linux Shell

The first chapter skips, the bottom starts from the second chapter, everybody understands.PS: Here is a very important thing when my egg hurts, very! Already code article code to the fourth chapter, the tragedy of the wrong browser button to refresh,

Linux uses pipeline command to perform PS get CPU and memory footprint _linux Shell

Copy Code code as follows: #include #include int main () { Char castdoutline[1024]; One line of information in the standard output of the PS command char* pctmp = NULL; A string that points to a space split Char caselfpid[10]; PID

Linux Faux write chmod command _linux Shell

Copy Code code as follows: #include #include #include #include int main (int argc,char **argv) { int mode; int Mode_u; int mode_g; int mode_o; Char *path; if (argc{ printf ("%s \n", argv[0]);; Exit (0); }

Ubuntu under timed submission code to the SVN Server shell script sharing _linux Shell

svn

There are two uses, one is lazy do not have to submit code, the second is used on the remote server for regular backups. Copy Code code as follows: sudo gedit/etc/crontab When you open it, join the line. Copy Code code

Script Shortcuts tool to simplify shell terminal command input _linux shell

1. The problem addressed When you need to enter many commands at once, for example, to remove files from multiple directories at once Copy Code code as follows: CD Dir1 RM file1.temp Cd.. /.. /dir2 RM-RF Dir3 When you

Shell script Implementation Delete mail queue _linux shell

Recently encountered a problem: The machine mail queue is always stuffed, but do not know where to send mail written, very egg pain, no way, only temporary treatment, wrote a delete mail script rm_mqueue.sh. Copy Code code as follows:

Shell script implements illegal IP login automatic alarm _linux shell

The security and stability of the server is the goal that every operational dimension wants to achieve, after all, once the site traffic is big, visit high, there will be some boring people to attack, to help detect the loophole is good, but the

method to get the absolute path of the script's directory in the shell _linux shell

To get the absolute path of the executing program/script itself, you can use DirName (Realpath (__file__) in PHP, and C # has System.Windows.Forms.Application.StartupPath; Java does not seem to have any more direct method, can only use Codesource to

Shell script implementation detects if a process is running _linux shell

Here is a brief description of a bash script that you wrote to detect if a process exists. directly on the code. Copy Code code as follows: #!/bin/bash ps_out= ' Ps-ef | grep $ | Grep-v ' grep ' | Grep-v $ ' result=$ (echo $ps _out |

Run and exec usage sharing for Wscript.Shell objects in VBScript _vbs

Set exers = objWS. Exec ("Pscp-r-scp-pw" & Password & "" & loginID & "@" & Host & ":" & Data_path & Filen Ame & "" & Windows_path)But inTestOfWhenWait, be handcuffed.BayesianThe file thanMoreBig, cuff.Longer shell timeOfWhenWait on theIsCmdWindow

Total Pages: 541 1 .... 350 351 352 353 354 .... 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.