#!/bin/Bashdatadir="/mydata/data"sqlconf=/etc/Mysqlinstalldir=/usr/local/mysql# about the installation package you can go to the official website to download, pay attention to download the common binary format, and then put on the FTP server can be #
Positional variables$ A Gets the file name of the current user script contains the path$n gets the nth parameter of the currently executing shell script if n is greater than 9 in curly braces ${10}$# gets the number of arguments for the currently
When writing a shell script today, one of the actions is to use the grep command to search for the specified content in a file. Specifies that the content is stored in a file, using a variable to get the contents of the file, and then uploading to
IntroducedBefore I had a blog post that describes how to automate Hadoop decommission with Ansible playbook, this article describes using shell scripting.The scripts are placed on the springboard machine, and the remote server calls the local script
Linux shell& Environment variableswhen you log on to the system, a user shell is started. In this shell, you can use a shell command or declare a variable, or you can create and run a shell script program. When you run a shell script, the system
linux,shell2015-02-07 1. Scheduled tasks: Corntab-e writing Scheduled Tasks CORNTAB-L viewing Scheduled tasks Corntab-r Clear all Scheduled Tasks If you want to clear a scheduled task, you can go to the edit page of the
Loading the shell process through process 2, in detail execve, this article, the last shell program to start executing the linear address is 128MB, due to Free_page_tables, has released the 32nd-bit page directory entry. Therefore, a fault is
Linux shell $$, $#, #!, $*, $, [email protected], $-, $0~$9 meaning$$Shell itself PID (process ID)#*All parameter lists. such as "$*" in the Case of "" ", in the form of" $ $ ... $n "output all parameters.[Email protected]All parameter lists. such
Recently the system has learned shell programming.See an example in the book, very dick. I thought about it before, but I didn't get the result.I believe that the students also guessed this example, is a line of string splitting. Students can try it
Numerical comparison:N1-eq n2 Check if N1 equals N2 n1-le n2 check N1 is less than or equal to N2N1-ge n2 Check if N1 is greater than or equal to N2 n1-lt n2 check N1 is less than N2N1-GT n2 Check if N1 is greater than N2 N1-ne N2 check N1 is not
&& operators:Command1 && Command2&& the command on the Left (command 1) returns True (that is, returns 0, executed successfully) and the command (Command 2) on the right side of the,&& can be executed, in other words, "If this command succeeds &&
File comparison Operators-e filename true if filename exists [-e/var/log/syslog]-D filename True if filename is a directory [-d/tmp/mydir]-F filename True if filename is a regular file [-f/usr/bin/grep]-L filename True if filename is a symbolic link
30.tee: Reads the standard input and then displays it by the standard output and stores the data in the specified fileExecute this command, test.txt if it already exists, it will be emptied, if it does not exist a new file will be created, end the
Because the use for to read in the file line, will automatically put the space and newline characters as the same delimiter, because when there are spaces in the line, the output will be very messy, so ...Cat Input.txt |while Read line> Do> Echo
Common returns in the shell are: Exit,breakm,returnExitIn fact, after each command is completed, it will return an execution state!If the execution succeeds, it returns 0If execution does not exceed, return non 0!Example application: Use the shell
1.1) Integer calculation:(1)$ (()): for mathematical calculationsecho $ ((3+3))(2)Expr: There must be spaces on either side of the operator, if $[] is included, you do not have to consider whitespace issuesExpr 2 + 22) floating point calculation:BC
The tput and printf functions are required to print the progress bar in the shell.# tput Row col cursor moves to row row column Col# tput cols Gets the maximum number of columns in a window# tput lines Get window max running script# echo $LINENO Get
The shell determines whether the file, directory exists, or has permissions#!/bin/sh mypath= "/var/log/httpd/" myfile= "/var/log/httpd/access.log" #这里的-x parameter Judging $ Whether the MyPath exists and has enforceable permissions if [!-X '
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.