11.1 Declare: Show or set shell variables
11.2 Export: Display or set environment variables
11.3 Set: Display and set shell variables
11.4 unset: Deleting a variable or function
11.5 env: Viewing and setting environment variables
$ A This is the path to the script file itself (relative path)If there is an execution script file under the current directory, you cannot write an absolute path for execution.$# this variable to record the number of input parameters6 is the number
Linux Shell functions
Write in front: function, this word in just the beginning of the classmate looks very tall, in fact, the shell inside the function is very simple, function is actually to reduce the amount of code, so this space may be
In Linux has been learning for one months, today to write a small script, wrote three different, although simple, but you can see, I wrote the script is ping3 times to see if the host is alive!The first one is ~ ~ for~~ loop because I knocked it
Exercise 1:Print a line with only one numberRequirements: title, a text document with only a number of lines to print outReference Answer:#!/bin/bash# date:2018 March 16 f=/etc/groupline= ' wc-l $f |awk ' {print $} ' for L in ' seq 1 $line ' do n= '
method One: Switch toShellthe directory where the script is located (at this time, called the working directory) executesShellScript:Cd/data/shell./hello.shThe./ means to execute hello.sh under the current working directory . If you do not add
This article mainly describes the "Aix escalation:" Shell will time out in the seconds "solution", mainly related to Aix escalation: "Shell will time out in the seconds" solution, for the AIX escalation : "Shell will time out in seconds" solution
Exercise 1:Statistics and summationRequirements: calculates the number of digits that appear in each row in document 1.txt and calculates a total of several numbers in the entire document.Reference Answer:#!/bin/bash# date:2018 March 6 sum=0for i in
Transferred from: http://www.cnblogs.com/lishun1005/p/6054816.htmlIn view of debugging Logback and log4j file cutting has not been successful, with the shell to write a script to cut Tomcat under the log file (everyone if you have in Logback or
1.1Write a login welcome script(1a new script file, welcome.sh, is used to output various monitoring information. [[Email protected]~]#vi/root/welcome.sh#!/bin/bashEcho"Number of open processes: $ (PS aux | wc-l)"Echo"number of logged-in users: $
Exercise 1: Monitoring disk usageRequirements: Write a shell script that detects all disk partition usage and inode usage and logs to a log file named after today's date, and notifies you when a partition capacity is found or the Inode usage is
Variables and environment variablesThe shell environment usually has many variables, and the variables can be viewed in the form of echo $VAR or ${var}. The SET command can view all variables in the current environment (including general custom
First, Shell discussionSecond, the script execution modeCreate and open a shell scriptVim Hello. SHEdit#!/bin/Bash#-E allows echo to support Shell escape character echo"\e[1;34m First shell script \e[0m"Run#赋予权限, running (common) chmod 755 Hello. SH
1. PurposeCopy all files larger than 1M (customizable) in the/root directory to the/tmp/bakdir (customizable) directory, and you need to keep the directory structure.For example, the/root/reed.file file size is 12M and will be copied to
Definition of shell array:Method 1: The variable value is assigned to the array variable with a small extension, and each variable value is separated by a space.The syntax is as follows:array= (value1 value2 value3 .... ) #常用Method 2: Enclose the
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.