Shell Foundation-environment variable configuration fileSource configuration file or. Configuration file:After the environment variable is written to the configuration file, the user needs to re-login to take effect, but with the source command, it
CentOS Shell Basics 2015-4-8 12th SessionThe first half of the classThe second half of the classHistory: Command history, save 1000 commands by default!! : Previous command!$: Last parameter of previous command!n: Executes the nth command in the
FunctionFunctions have the same functionality:Simply put, the function of the program is to call the same part of the code in a number of parts, and then a name, so the function is called the name can be, in the modification of the code, only need
Variable setting rules:Variable names can consist of letters, underscores, and numbers, but cannot start with a number.The default type of a variable in bash is a string type, and if a numeric operation is required, specify the variable type as
First, what is the landing shell? What is a non-landing shell?1. Landing shell means:(1) When the user logs on, enter the user name and password to start the shell;(2) through the command with the--login parameter: The shell launched by Bash--login.2
1 , describes the operation principle of shell program (can be attached with necessary graphical description);What is a shell?The shell acts as the shell of the operating system, providing the user with an interface to use the operating system. It
First, use '. ' Perform1. Contents of the file:a.sh#!/bin/sha=2echo a= $ab.sh#!/bin/sh./a.shecho a.sh:a= $a2. Add executable permissions# chmod +x a.sh b.sh3. Running#./b.sh a=2a.sh:a=It can be seen that a in b.sh does not get the A variable in a.sh,
Use df-tph to view hard disk usage under Linux:sdua:/# Df-tphfilesystem Type Size used Avail use% mounted On/dev/vda3 ext3 2.0G 974M 940M 51%/udev tmpfs 16G 500K 16G
Organize multiple sources from the network.1, source and Point command, the same function, the source is different.The source command is a built-in command of the Bash shell, which comes from C shell. Another notation for the source command is the
TopicWrite a script1. Pass a parameter to the script, this parameter is the user name;2. If the user exists, perform the following tasks* If the user's ID number is less than 500, display it as an administrator or system user;* Otherwise, display it
最近在windows上编辑一些shell脚本后上传到交换机框体上后,这些shell脚本无法执行,每一行结尾都有‘^M‘,同时框体上又没有dos2unix工具,这么多脚本也不可能一行一行来修改,于是就自己写了一个脚本来把当前目录下所有文件中的‘^M‘去掉。#!/bin/shFilename=' ls ' forFinch ${filename}; Do if[- F ${f}]; Then Echo "Delete ' ^m ' and rename file to ${f}1
Scripting: Stacking of commandsThe first line of any script:#!/bin/bash: The Interpreter pathIn addition to the previous # number as a commentExecute permission before script execution: chmod +x file nameCondition Judgment in bash:Condition Test
Input command hbase Shell entersTo view all tables that exist:ListTo view the table structure:Describe ' table name 'Query the contents of the table:Scan ' TABLENAME '-----For example have a student table to view it scan ' student 'Add, update data :
In general, you may need to switch the root user to another user for execution during the automation process, such as: OralceHowever, the execution of the command will return to the root user, continue to execute other commands under the root
grep Basic Usagegrep [Options] [mode] [file:]Options-C outputs only the number of matching rows-I ignore case when searching-H does not display file names when querying multiple files-L searches only for matching file names, not specific matching
In the loop, sometimes you need to force out of the loop when the loop end condition is not reached, like most programming languages, the shell also uses break and continue to jump out of the loop.Break CommandThe break command allows you to jump
The Linux shell is much more powerful in programming than Windows batch processing, both in loops and operations. Data types are not comparable. Here's a summary of some of the things that an individual does when it comes to working with arrays.1.
Environment variable configuration file for Shell programming,
I. Introduction1. Variable type:User-Defined variables (local variables)Environment variables: Define the operation environment for each user. The learned paths and ps1 are used. To
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