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"
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]
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
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
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
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
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
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
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,
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
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);
}
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
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
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:
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
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
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 |
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