[[Email protected] shell]# date +%y year, 4-digit2018[[Email protected] shell]# date +%y year, 2-digit18[[Email protected] shell]# date +%m Month04[[Email protected] shell]# date +%m M, number of minutes57[[Email protected] shell]# date +%d13[Email protected]
First, the name of the variableThe variable name must begin with a letter or underscore, consisting of a letter, number, or underscore, and the variable name cannot exceed 255 characters in length.Ii. Classification of variables1. User-defined variables2. Environment variables3. Positional parameter variables4. Pre-defined variablesThird, user-defined variablesA user-defined variable is a "local variable" that can only take effect in the current shell1. Defining variablesVariable name = variable
Linux Shell series (6) Shell array and shell Array
This article is part 6 of the Linux Shell series tutorials. For more shell tutorials, see the Linux Shell series tutorials.Shell is very powerful in programming, and its array fun
time. you can use the set command at the $ prompt to set or cancel the shell option, and use the-set option, + cancel the corresponding options. most UNIX systems allow switch setting/cancellation of a, e, f, h, k, n, u, v, and x.
Set-xv
Start tracing method. all commands and replicas are displayed, and input is also displayed.
Set-tu
Disable the check for undefined variables during replacement.
Use echo $-to display all configured
Getting started with Shell: Shell variables, getting started with shell VariablesShell entry (1): the first program of Shell variable Shell script
Log on to the console using the Linux User Name and enter the ls command:
Create a test directory in the current file directory
Shell: Can batch processing, automation to complete a series of maintenance tasks, greatly reduce the burden of administrators! The shell is a special application that acts as a "command interpreter" between the operating system kernel and the user. is responsible for receiving the user input of the operation instructions, and explain, will need to perform the operation passed to the kernel execution, and o
By using the startup script, you can make the custom environment ready for use once and for all.These scripts run when the shell is created.The startup scripts run vary depending on whether the shell is used to log on to the shell or not.We use "Su-" to log on to shell; "Su" to log on to non-shell.Typical examples in t
["$ PS1"]; then # if the shell environment exists and is not sh, read/etc/bash. bashrc if ["$ BASH"] ["$ BASH "! = "/Bin/sh"]; then # The file bash. bashrc already sets the default PS1. # PS1 = '\ h: \ w \ $' if [-f/etc/bash. bashrc]; then. /etc/bash. bashrc fi else if ["'id-U'"-eq 0]; then
1. Understanding Bash
Through the shell will input the instructions and kernel communication, let kernel control hardware workView Shell:cat/etc/shellA preset shell type is recorded in the/etc/passwd after login and is related to the accountCommand alias: Alias lm= ' Ls-al ' #注意有无空格Help: Man bashCommand types: Type
Copy Code code as follows:
Type ls # ls is aliased to ' Ls–color=auto '
Typ
[Shell] basic Shell functions: Historical commands aliases, and basic shell functions
Bytes --------------------------------------------------------------------------------------------------------
I. History commands
History# View historical commands
History-c# Clear history commands
History-w# Directly write the history commands in the cache into the hi
Look at the previous section: Linux Shell Data Redirection (input redirection and output redirection) detailed analysis It is estimated that some friends are dizzy, so complex redirect. This time we'll take a look at the pipe command. Shell pipe, it can be said that the usage is much simpler.
The pipe command operator is: "|", which can only handle the correct output information from the previous instruc
programming language, shell also provides instructions and the ability to use variables. For shell, the values of all variables are a string, and the shell program uses $ var to reference the value of the variable named var.
Shell has the following basic types of variables:
(1) environment variables defined by
The shell itself is a program written in C, which is a bridge for users to use Unix/linux, and most of their work is done through the shell. The shell is both a command language and a programming language. As a command language, it interprets and executes user-entered commands interactively, and as a programming language, it defines variables and parameters and p
The shell itself is a program written in C, which is a bridge for users to use Unix/linux, and most of their work is done through the shell. The shell is both a command language and a programming language. As a command language, it interprets and executes user-entered commands interactively, and as a programming language, it defines variables and parameters and
The shell itself is a program written in C, which is a bridge for users to use Unix/linux, and most of their work is done through the shell. The shell is both a command language and a programming language. As a command language, it interprets and executes user-entered commands interactively, and as a programming language, it defines variables and parameters and p
Invoking awk in a shell script is very natural and simple, so let's look at awk calling the shell and passing the variable to the Shell,awk using the variables in the shell, awk passing the value to the shell variable
Invoking awk in a
[Shell] How Shell scripts are executed, and how shell scripts are executed
Bytes ----------------------------------------------------------------------------------------------------------
Command to complete most output tasks: echo
Echo helloworld; # correct
Echo "hello world"; # correct
Echo "hello world! "; # A space must be enclosed in quotation marks! In Linu
Tags: shellShell Script IntroductionShell is a scripting language blog.lishiming.net (Amin blog, you can go inside to find the shell problem)You can use logical judgments, loops, and other syntaxFunctions can be customized to reduce duplication of codeThe shell is a collection of system commandsShell scripts enable automated operations, which can greatly increase our operational efficiencyShell script struc
execution, shell has defined some variables related to the system's working environment. You can also redefine these variables. Common shell environment variables include:
HOME: the full path name used to save the registration directory.
PATH: used to save the directory PATH names separated by colons. shell searches these directories in the order given in the PA
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.