Learn about convert shell script to batch file online, we have the largest and most updated convert shell script to batch file online information on alibabacloud.com
Today received the relevant departments reflect that the storage space is not enough. You need to delete some video files to make room. As soon as I took the job, I wrote a python script. Helpless, personal Python level is also an introduction. So you can only write another shell script to get the job done.Disclaimer: The following operations are performed on the
Use the Shell script in Linux to switch the settings of Maven. xml File 1. Problem background www.2cto.com because there are separate maven configurations in the company and at home, you need to modify settings frequently. the activeProfile in xml to switch the profile. It's still too troublesome...
Use the Shell
There is demand, can let oneself lazy is the real motive force of study. Because the test environment always needs to manually modify the configuration file after building the code, the learning side completes a shell script that can be modified with one click.Defines a function that displays the output information in a green font.function Echo_green { "\0
file, it will need to be operated 3 times.In short, very silly, very stupid."Shell script Implementation"The source code is as follows:#!/bin/bashfunctionRead_dir(){ forFileinch' ls $` Doif[- D $"/"$file]; ThenRead_dir $"/"$fileElseEcho $"/"$filefi Done}#output FilesTouch Out_files.txtRead_dir"/home/laoyang/test/res
Today, there is a very strange problem, the shell script that has been running very normal failed, but yesterday added a parameter.Error message:/bin/bash^m:bad interpreter:no such file or directoryLater found that root cause, modified the file yesterday in Windows modified save, and then uploaded. The
the file exists
The touch command is used to create an empty file, and the chmod command is used to assign weights.
Special attention:
Shell script to the space requirements of the strict, must pay attention to the space, otherwise error you check are difficult to check.
If condition use end must
This article mainly introduces PHP execution shell script program does not produce a core file method, interested in the friend's reference, I hope to be helpful to everyone.
found that the core file was not produced, but the core file is generated when the
Shell script -- run hadoop on linux Terminal -- the java file is saved as test. sh. the java file is wc. java, [Note: it will be packaged into 1. jar, the main function class is wc, the input directory address on hdfs is input, and the output directory address on hdfs is output. [note: The input directory and output di
ll command to view file informationThe first root represents the creator of the file, and the 2nd root represents the group root that the file belongs toRWX delegate Rights R (read) permission, W (write) write permission, x Execute permission, default one file owner does not have permission to executeFor Linux users:1.
THE sh file cannot be modified in windows.Because most people use windows as the operating system and the visual interface of windows is more user-friendly, when modifying a linux sh file, edit it with editplus to facilitate pulling it to the window, after uploading it back to linux, the sh cannot run. The error message is: command not found.
The cause is the CR/LF problem. In dos/window, press the Enter
The shell commonly used file judgment operators are as follows:-e file is present-F file is a normal file (not a directory, device file, linked file)-S means that the
Determine how long the Linux file has been modified to perform actionsCreate a scriptvi/var/tomcat/find.sh#!/bin/bashA= ' stat-c%y/var/tomcat/logs/catalina.out ' //Get File modification time (in seconds)b= ' Date +%s ' //time to get the current system (in seconds)If [$[$b-$a]-gt 1800]; //To determine the current time and file changes (30 minutes)Then/sbin/service
a.shCloseBye!
As a friendly reminder, we'll save the shell script above as a file, and then execute it with crontab.
Some examples of rontab files:
The example above, * * * * */usr/local/etc/rc.d/lighttpd restart , represents 21:30 restart Apache per night. The example above, 4 1,10,22 * */usr/local/etc/rc.d/lighttpd restart , represents 4:45 resta
This example shows how to read and operate a specific field from a data file in a shell script in Linux. For example, the format of the hypothetical file employees.txt is {employee-name }:{ employee-id }:{ department-name}, which is divided by a colon, as shown below. Www.2cto.com $ cat employees.txt Emma Thomas: 100:
Article Title: script for viewing the dbf file compiled by shell. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Not perfect, but it's okay, and the speed is a little slow!
#! /Bin/ksh
Hd-abdA $1 | sed-n '1p' | cut-c7-70>
Original address: http://blog.csdn.net/taiyang1987912/article/details/39995175#查找文本中n个出现频率最高的单词 #!/bin/Bash Count=$1#$1 is the number of words with the highest output frequencyCat$2|#$2 is the target text file name, but it's a string .TR-cs"[a-z][a-z][0-9]" "\ n"| #tr是sed的简化,-C Replace the string with the complement of the character set in the preceding string with a word that will not be a character or a number instead of a newline #-s removes all oc
If you manage a large number of sites and servers, it is quite painful to modify the configuration file every time. So I thought of using shell scripts to generate bulk configuration files and configuration data. The following script is a shell script that generates the Nagi
Today see a help post ask this thing again, so boring wrote a.
With the awk script, which is that the script interpreter uses/usr/bin/awk instead of/bin/sh
But it's all a script, if you want to.
You can call me this awk script with a shell
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.