1. What role does Eval have in the shell? Could you give me an example?Role:#!/bin/bashAa=h1Bb=h2var= (AA bb)For VAS in ${var[@]}Do Echo $vas Eval Var_temp=\$${vas} Echo $var _tempDone2. What is the role of dirname? Could you give me an
In the Iterm2 v3.0 version, there is a new Feature--shell integration, the more important function is to replace the traditional "RZ", "sz" (that is, upload to the server, download files)The specific usage can be found on the website as
First, the user logged into the system after the system environment variables:$HOME user's own directory$PATH the directory that was searched when the command was executed$TZ Time Zone$MAILCHECK How many seconds to check if there are new letters$PS 1
The following is an explanation under the bash environment.One, single parenthesis ()Two, double parenthesis (())Can be used as a numerical condition or as a numerical operation (approximate to let command)Like the C language syntax, supports
& placed after the startup parameter to set this process as a background processBy default, the process is the foreground process, then the shell is occupied, we can not do other operations, for those who do not interact with the process, many times,
The shell is known as the system administrator's choice for its stability, efficiency, and flexibility. The basic shell commands are described below, including directory switching, locating and viewing files, viewing user information, and more.1.
The order in which environment variables are loaded after Linux startup is: ETC/PROFILE→/ETC/PROFILE.D/*.SH→~/.BASH_PROFILE→~/.BASHRC→[/ETC/BASHRC]To change the color of the shell font after a user logs in, add PS1 content to the ~/.BASHRC, and the
While loop: Tests a condition repeatedly, as long as the condition is set up and executed repeatedlyThe condition can be: test the expression, or the Boolean value true (the condition is always true) and false (the condition is always false)vi
For i in a B CDoEcho $iDone!ser Historical complements> Correct information output file>> correct information output file, append2> error message output file2>> error message output file append&>> all outputsfree-m | Grep-i Mem | awk ' {print $4,$3}
Shell-0. Introduction1. Use shell scripts in those environments• Application environment: Several complex parameters are required to execute certain commandsRequires multiple commands for State view and maintenance management of the systemRegular
1. For loop statements1.1. Syntax Format:For Var in listdo Commandsdonefor ((expression)) do Commandsdone1.2 Simple example:#!/bin/sh# read echo from the direct list "read from direct list" for Var in 1 2 3do echo "$var" Doneecho "\ n"
Sometimes we use a function often, it is very troublesome to assign a value in each script, this time we can write the function that we use frequently in the form of function library.A very simple little example: do we need to know which version of
1 Case-sensitive UNIX is case-sensitive, so shell scripts are case-sensitive 2 special characters Some characters of Unix have special meanings or functions that must be escaped if they are not used in their special sense (escaped). In order to
First, 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
A lot of friends do not know how to use shell scripts to collect information about the Linux system, including CPU, memory, disk, network and other information, here the script to do a small part of the explanation, we come together to see it.First,
Take a few simple examples of the judgments involved1. Comparison of file-related judgments#!/bin/Bashif[$#-lt1 ] Then Echo "No file name"Exit1elif[-D $1 ] Then Echo$1is directoryelif[-B $1 ] Then Echo$1is block deviceelif[-
Using the remote shell tool SSH login to the Linux host, the user name after the return to the card, 10 seconds after the prompt to enter the password.Use Wireshark to catch the whole process packageBecause SSH is an encrypted protocol, it is not
if ["$test" x = "Test" x]Here are a few key points:1 with a single equals sign, two equals signs can be2 Note that there is a space on each side of the equal sign: This is the UNIX shell requirement3 Notice the last X of "$test" X, which is
The history command allows you to view all of the user's historical records under Linux. At the same time, the shell command action record is saved by default in the. bash-history file in the user directory, through which you can query the execution
IntroductionVariables are an essential part of Shell scripting, and using variables in scripts does not need to be declared in advance. Each variable in bash is a string, so whenever a variable is assigned a value, whether or not the quotation marks
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