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

6 ways for Linux to delete a large number of files _linux shell

Create 500,000 files first Copy Code code as follows: Test for I in $ (seq 1 500000) For> do for> echo Test >> $i. txt For> Done 1 RM Copy Code code as follows: Test Time Rm-f * Zsh:sure you want to

Linux command detailed method of mounting the optical drive _linux Shell

Linux hardware devices in the/dev directory, the optical drive is one of them./dev/cdrom represents the optical drive, the method of mounting the optical drive is as follows (in root): Copy Code code as follows: Mkdir/mnt/cdrom

Win2003 Wscript.Shell and Shell Component Security Chapter _win Server

Uninstall and remove the WScript component Wscript.Shell can invoke the system kernel to run DOS basic commands, which is harmful to system security. We're going to uninstall and remove the component to prevent this kind of trojan from

Shell script implementation quickly generate XML format sitemap instance share _linux Shell

Use the shell to quickly generate a sitemap map file in XML format, which is suitable for small and medium sized websites. In this case, a sitemap file with 12,053 URLs is generated and only spents 4.3 seconds! The shell code is as follows: Copy

Shell log Analysis common commands and examples _linux shell

Learn to use shell analysis log only one morning!!! Many places to share the log analysis of the shell script, but basically did not say the specific meaning of each command, learning cost is very high, summed up here, to facilitate the quick start.

Shell string comparison Equality, inequality method summary _linux Shell

#!/bin/sh #测试各种字符串比较操作. #shell中对变量的值添加单引号, the difference between the hot quotes and the not added: it is irrelevant to the type, that is, not adding quotes into the string type, #单引号不对相关量进行替换, if the $ symbol is not interpreted as a variable

Shell script functions: control color, positioning, center display code _linux shell

One, control colorCode: Copy Code code as follows: #!/bin/sh function colour () { Case is in Black_green) Echo-e ' \033[40;32m ' Black_yellow) Echo-e ' \033[40;33m ' Black_white) Echo-e ' \033[40;37m '

Introduction to Shell command-line parameter usage _linux shell

A shell script, what is its command parameter?First, shell scripting and scripting like Python can use parameters as well;Secondly, the shell parameters are divided into positional parameters and internal parameters;Where, positional parameter: is

Linux traffic monitoring shell script _linux Shell

Recently more busy, for a long time did not update the blog, today is not busy writing a traffic monitoring script. The test has passed under the CentOS, has the need friend to try, has the bug or needs to add other function words can leave a

Shell Script Monitor Site page normal open _linux shell

Now in order to save money, I used a shell script, simply write a monitoring. By Curl a fixed page of 200 status code, if it is 200, said the site is normal, if not 200 automatically restart the site, and then send mail to QQ mailbox. QQ on their

Shell Script Implementation example of automatic sending mail _linux shell

1, edit the user's home directory of the. muttrc file, set the letter environment. Copy Code code as follows: # CAT/ROOT/.MUTTRC Set Envelope_from=yes Set from=owinux@sina.cn Set Realname= "Owinux" Set Use_from=yes Set Rfc204

Shell Common redirect instance explain _linux Shell

Each open file is assigned a file descriptor. stdin (keyboard), stdout (screen), and stderr (Error message output to screen) are the file descriptors 0, 1, and 2 respectively. The descriptor 3 to 9 is retained for the extra files that are being

Copy the file n copies of 2 shell script code _linux Shell

A large number of files are required for testing, so a script is written to copy. A regular file name facilitates reference. Copy Code code as follows: #!/bin/sh # file Name:batchcp.sh # Author:zhouhh #

Intelligent monitoring automatically restarts the Apache server's shell script _linux shell

With the need to monitor some of the Apache servers that require high availability, in addition to professional monitoring and alerting devices, it is a good idea to write a script that automatically monitors Apache status on the Apache server at

5 ways to calculate the length of a string in a shell script _linux shell

Sometimes in the Linux operating system to calculate the length of a string, through the query data to the current shell to get the length of the string of various methods to share here, the method is as follows: Method 1: Use the wc-l commandWc-l

Implementing the flying text effect in shell _linux shell

You must have seen the effect of flying words on a Web page, but how do you implement the Echo string in a Linux system, especially in Bash command line mode, with flying effects? This effect is not practical, but occasionally to amuse themselves

Sharing of shell scripts for Linux system security (applicable CentOS) _linux shell

We will use the common system security configuration as a shell script, only to run this shell script on the server to complete the security settings. Linux system security Settings Shell script is the second update, has been heavily used in a

Shell handles a file name with a space _linux shell

Nowadays many people like to use spaces when they are named, such as "an Introduction.doc". But this naming problem is confusing to Linux command-line tools and shells, because most commands use whitespace as a separator between values and values,

Shell traversal of all files including subdirectories

1. Code is simple, but difficult to verify, not as good as Python understandingIt is recommended to edit under notepad++.2. Note the ' Yes ' tab key that references the Linux command.3.if[] HereError:syntax error near unexpected tokens ' then 'Cause:

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