1. Must enter the pure digit, ignores similar ' 2 ' ' 3 ' the number with the space input before and after2. The digital range must be controlled in 10 ~ 90
#!/bin/bash status= ' err ' start=10 end=90 while [$status!= ' OK '] do ifs= ' read input
In a Linux environment, automate installation steps for multiple packages:
1, find the software package, extract the name of the package to establish the decompression path (in order to let us more clearly find our files)
Pkg= ' Find
Modifying a row record in an XML file with a shell script
As before, suppose the following XML file:
Web.xml has the following contents:
cookieName
sessionName
Requirements: Now you need to replace the value of cookiename with a shell
Replacing a row record in a property file with a shell script
Hypothetical as subordinate file Demo.properties
User.name=test
user.password=123456
...............................
Requirements: First you need to replace the value values of
Usually in the console input commands such as: sudo, SSH, ftp or modify the admin permissions of the file will require input password, but in the She ll script to run the process of how to automatically enter the password.
Below is a summary of
Gzexe
Installation and use
The system is self-contained with no installation required.Use the following command to encrypt:
Gzexe tesh.sh
After the encryption is complete, test.sh is the encrypted file, while the source file is backed up as test.
In a production environment, there is usually a large number of resident processes in a cluster, and it is necessary to be able to monitor and recover quickly when a process hangs.
The general Operation Engineer will choose to implement in Python,
Shell judge file, directory exists or have permissions #!/bin/sh mypath= "/var/log/httpd/" myfile= "/var/log/httpd/access.log" #这里的-x parameter judgment $ Whether the MyPath exists and has executable permissions if [!-X "$myPath"]; Then mkdir
This article writes that Java invokes the Linux shell command and returns the result as a stream.
The following is directly on the code, the code is annotated.
Very plain and easy to understand.
Import Java.io.BufferedReader;
Import java.io.
Shell--command parser, also a programming languageBash-a specific instance of the shell, zsh, bash are instances of the shell
The "Echo $SHELL" command can be used in the terminal to view the shell instance currently in use and can be switched to
Let's take a look at some of the basic operations commands of the HBase shell, and I've listed several common hbase shell commands, as follows:
Name
Command-expression
Create a table
Create ' table name ', ' column
The script file name is unzip-batch.sh# bulk unzip the compressed file, unzip the file to the specified directory#!/bin/bashFor zipfilenamefull in ' ls./*.zip 'Do#echo "$zipfilename"Zipfilename= ' basename $zipfilenamefull 'filename=$ (basename
First, Introduction
1.
Cal Calendar
LS Viewing files and directories
WHOAMI Viewing Current user information
Users or who or W view the current online user
Logout Sign Out
Shutdown or Powoff shut down the system
Init 6 or Reroot reboot system
passwd
We can pass parameters to the script when executing the Shell script, and the format of the parameters obtained in the script is:$n.n represents a number, 1 is the first argument to execute the script, 2 is the second argument to execute the script,
This example takes the class C address as an example, if it is a Class A or class B address, the script can be modified slightlyIpaddr= '/usr/sbin/ip a | grep $1 | grep inet | awk ' {print $2} ' netmask= ' echo ${ipaddr} | awk -f '/' ' {print $2
First step: Use a text editor to create a text file
The first line must include the shell declaration sequence: #!
#!/bin/bash
Add Comment
Comments start with #
Step two: Run the script
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