There are several ways to execute a shell script
1, relative path mode, need to first CD to script path
Copy Code code as follows:
[Root@banking tmp]# Cd/tmp
[Root@banking tmp]#./ceshi.sh
Script execution succeeded
2.
One of the benefits of Git is that the branch management of the code becomes an extremely convenient thing, the branch only retains the difference, does not have to copy any files, does not connect the network, quickly creates, uses is deleted. The
Most people will change it when they use Bash, because the default settings are really hard to use.
Refer to the following ~/.INPUTRC settings:
Copy Code code as follows:
# don't show hidden files in the list
Set Match-hidden-files off
Question: I want to know the process ID of the script shell in the run. How do I get the PID in the shell script?
When I execute the shell script, it starts a process called a child shell. As a child of the main shell, the child shell runs the
Today, my company colleagues came to me and said that I was going to execute the Python script on the server with another user, but it was always done by the root user in the crontab, so I thought of a lazy way to use the shell script to switch to
The previous script is in save mode, now attach the command to a file, so that it can be easily modified two times or somethingThe script is basically like this, we can change with their situation again ~ add function or something.
Parameters:Pathname, the path file name of the temporary file is stored, and the manual free () is required.Dir, the path to the temporary file, if the TMPDIR environment variable is not empty, this parameter is ignored and the environment variable
A case of a batch conversion directory of File encoded shell script code.
Requirements Description:As a result of turning Linux from Windows, many original win under the GBK file needs to be converted into UTF8.
The following script only judges
Today colleagues idle, asked me to help in the Linux login page to add something he thinks is very unique, look at his hair, said to him is very silent, below to see.
Script 1:
Cat clcal.sh
#!/bin/bash # show Chinese lunisolar calender. # 2011
Shuffle problem: Wash a pair of poker, what good way? Can be washed evenly, and can wash quickly? What is the efficient implementation of a disorderly arrangement relative to a file?
Chinaunix is indeed the place where the Shell masters are
1. When defining a variable, no spaces can be left on either side of the = number.eg:Gender=femal ———— RightGender =femal ——— –wronggender= femal ——— –wrong2. Conditional test statement [Both sides of the symbol must be left blank.eg:if [$gender =
Linux text processing tools are very rich and powerful, such as a file:
Copy Code code as follows:
Cat Log
Www.jb51.net 192.168.1.1
Www.jb51.net 192.168.1.1
Www.jb51.net 192.168.1.2
Ffffffffffffffffff
Ffffffffffffffffff
Copy Code code as follows:
#!/bin/bash
#author: 505056357@qq.com
echo "Backup Job Start"
#设置要备份的网站目录, that is, the root directory of the Web site
File=/home/wwwroot/default
#设置本地备份目录, for storing the packaged files
Add: This is valid for the first time to add a network card, if you need to repeat the addition and deletion of automatic configuration, you need to change the script, according to the IP a command information to modify.
Copy Code code as
This iptables script is good, very practical, according to the actual application can be changed to use their own. Share it for everyone to refer to. The original author anon. The source code is as follows:
Copy Code code as follows:
Command substitution means that the Shell executes a command and replaces the command substitution with the result of executing the command.
There are two ways to replace a command:
1. Use backtick symbols (i.e. ..., inverted quotes, accented
Wrote a little shell instance of myself, though very small, but all the big programs are stacked up by small modules, programmers must understand a script writing, and I, will only work under Linux, so you can only write Linux shell script, oh, this
Recently saw a few good small examples in the forum, for learning awk is still helpful, here in detail
A. A LEFT join query in a similar database
Copy Code code as follows:
[Root@krlcgcms01 mytest]# cat A.txt//a.txt
aaa
222 BBB
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