I. Type of shellIn terms of user login, the shell type is:1. Login Shell: (read environment configuration)Log in normally via a terminal:Su-usernameSu-l USERNAME2, non-logon shell: (do not read the environment configuration)Su USERNAMECommand window open under graphical terminalShell scripts that are executed automatically2.
results of the parameter expansion, command substitution, and arithmetic expansion that do not occur in double quotation marks in order to divide the word.The shell nonalphanumeric each word of IFS as a delimiter, dividing the other unfolded results into words based on these characters. If IFS is not defined, or if its value is "An explicitly given null parameter ("" or ") will be retained. An implicitly null parameter that is not referenced from a p
In bash shell, the handling of arrays is an error-prone place.Array:Variable: Stores the memory space of a single element;Array: A contiguous memory space that stores multiple elements;Array nameIndex: Numbering starting from 0, is a numeric index;Note: Indexes can also support the use of custom formats, not just numeric formats;The bash array supports sparse for
[" $? " != "0" ];thenecho "$TCP _portnotanumber." exit1fiport_no_exists[$CURRENT _port]= $TCP _portforlsn_portin $CHK _tcp_cmddoif[ $TCP _port== $LSN _port];then unsetport_no_exists[$CURRENT _port]breakfidone ((current_port++)) doneif[${#PORT_NO_EXISTS [@]}-gt0];thenecho " Tcpports${port_no_exists[@]}failed. " exit1fiExit0 When used, the port number is added directly after the script as a parameter, and if multiple port numbers are scanned, each port number is separated by a space. If one of t
Shell's advantage: You can call Linux system commands directlyBasic syntax for shell scripts:Script name ends with. shThe first action of the program #!/bin/bash, tell the system this is a shell scriptWith # as a commentHow shell scripts are executed:Give script execution permission first, chmod;It is called directly w
Here's what you'll find useful after reading the third chapter of the Linux command line and Shell script programming encyclopedia.1./ETC/PASSWD file This file contains a list of all system user accounts and basic configuration information for each user, as shown in: Each entry has seven fields, and the fields are separated by a colon, which includes:• User Name• User password (if the password is in another location, the bit is a placeholder)• User
of the parameters, that is, the value of the change $1,$2 ... $n, the values are rearranged in getoptEval set--"$TEMP"#经过getopt的处理, the specific options are processed below.While true; DoCase "$" in-a|--a-long) echo "Option a"; shift;-b|--b-long) echo "Option B, argument \ ' $ '"; Shift 2;;-c|--c-long)# C has an optional argument. As we is in quoted mode,# an empty parameter would be generated if it optional# argument is not found.Case "$" in"") echo "Option C, no argument"; Shift 2;;*) echo "O
Zhou haihan/Wen
2010.6.10
BASH Shell extension refers to an operation in which Shell expands commands when analyzing input commands. There are 7 extension methods. Refer to the man bash extension page:
Expansion
The braces (curly braces) extension method is also interesting.
Example 1: operate a file with multiple f
Preface The basic languages I have mastered: PhP (most familiar with, the code in the project is implemented using it), bash shell (O M tool), and C (ACM dedicated ), it seems that only C can implement multithreading, but C is only used to learn and implement algorithms and data structures. Therefore, I want to simulate concurrent multi-process operations in my work, you can only rely on the
Three ways to start bash shell1, log in as the default login shell2. Interactive shell as a non-login shell3. As a non-interactive shell for running scriptsFirst, login shellWhen you log in to a Linux system, the bash shell starts as a login
Several possible causes:1 The user's home directory belongs to a group that has been renamed Root, and the solution uses root to perform Cd/home/;chown username:username username2 The user's home directory was modified, this time if you want to modify the user's home directory, first switch to the root user, directly modify the/etc/passwd file, find your user name that line, modify it, but after the change to enter the system again when the user name may display-
Preface or today to write an automated packaging script, using the path name to get the last file name. Here is a record of the implementation process. Of course, in the end I will also give the official approach. (PS: Very embarrassing, realized that the original bash Shell has a ready-made function)The get file name assumes that the given path name is:/tmp/csdn/zhengyi/test/zhengyi.txtThe awk solution use
First, Bash shell overview1. What is BashBASH is the abbreviation for the Bourne Again Shell, developed from the SH-unix system, and is a tool for users to interact with the Linux kernel, using the bash operation kernel to complete the system's use and management.Types of 2.shell
and execute the associated program;assigns a new value to the shell variable;perform command substitution;handles I/O redirection and piping functions;provides an explanatory programming language interface, including statements such as tests, branches, and loops. BASH is the acronym for the borne again shell, which is a shel
What is a shell? What does bash do? What's the matter?The shell is the interface between you (the user) and Linux (or, more accurately, you and the Linux kernel). Each command you enter at the prompt is interpreted by the shell before being passed to the Linux kernel.The shell
In LinuxCentOS, shell displays-bash-4.1 $ solution to the problem where the user name path is not displayed: a new user is added under CentOS. after logon, the shell script information is as follows: instead of the username @ hostname combination we often see, it looks uncomfortable. Solution :... linux CentOS shell di
Purpose: Self-collation, self-review, self-reflection!Content: Dry Goods! Dry!! Dry!!!Attach: The shortcomings of the hope that you correct, can give like me rookie a little inspiration is the best. Just the inspiration ...Thank you: Thank the old boy (see your blog post and video, O (∩_∩) o haha ~), of course, there are online technology Daniel, reference book "UNIX Shell"Bash
$substring is a regular expression.Summary of some structures
An expression
meaning
if [CONDITION]
Test structure
if [[CONDITION]]
Extended Test structure
Array[1]=element1
Array initialization
[A-z]
The character range of a regular expression
${!variable}
Indirect variable Reference
{Command1; command2;.. commandn;}
code block
{Stri
Bash Shell Basic features three (array)One, the array definitionAn array is a contiguous number of independent memory spaces, each of which corresponds to a variable. The bash shell supports only one-dimensional arrays, but there is no limit to the number of arguments.Array elements: Array name + index (numbering start
Bash Shell Common shortcut keysOriginal: Https://github.com/hokein/Wiki/wiki/Bash-Shell%E5%B8%B8%E7%94%A8%E5%BF%AB%E6%8D%B7%E9%94%AEMove cursor
ctrl+b: Move forward one character (backward)
ctrl+f: Move back one character (forward)
alt+b: Move forward one word
alt+f: Move back one word
ctrl+a:
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.