logical relationship between the commands around the symbol.ls Echo " Hdakl "Ls:cannot access das:no such file or directoryHdaklEcho " Hdakl " ls ds Hdakl general use of and | | , it's basically logical and logical, or :command1 Command2 | | Command3. Because in practice, Command2 and Command3 should all be commands that you want to execute. If Command1 is executed correctly, $? equals 0, executes Command2, and then the situation executes Command3, if the Command1 error executes, $? is not
updated successfully.Changing password for user bruce03.Passwd:all authentication tokens updated successfully.Changing password for user bruce04.Passwd:all authentication tokens updated successfully.Changing password for user bruce05.Passwd:all authentication tokens updated successfully.Changing password for user bruce06.Passwd:all authentication tokens updated successfully.Changing password for user bruce07.Passwd:all authentication tokens updated successfully.Changing password for user bruce0
after the PATH variable2. ~/.BASHRCRole:1) define an alias alias for the RM CP MV2) Call/ETC/BASHRCIV. environment variable File execution flow1. User login Normally, will be loaded from/etc/profile to/ETC/BASHRC2. User non-normal login [not login Shell], such as through the SU Switch user, will start from/ETC/BASHRC, and finally to/etc/sysconfig/i18nV. Other environment variable configuration file 1. ~/.bash_logoutThe environment variable configurat
:"Read Anum Case$aNuminch 1) Echo "you chose 1." ;; 2) Echo "you chose 2." ;; 3) Echo "you chose 3." ;; 4) Echo "you chose 4." ;;EsacSeven, breakJump out of all loops (terminates all loops after execution) while : Do Echo-N"Please enter a number from 1 to 5:"Read Anum Case$aNuminch 1|2|3|4|5) Echo "the number you entered is: $aNum" ;; *) Echo "the num
1. Explanation: A single string that describes or matches a series of strings that conform to a certain syntactic rule.Action object: StringMany are used in document editors or other tools to retrieve and replace text content that conforms to patterns.Common Grep,sed,awk2.grep filtering, printing;-incvabc-I ignores case,-n displays line numbers, and-c counts the number of rows that meet the requirements;-V prints rows that do not conform to the requirements,-an prints rows that match and the nex
/BASHRCIV. environment variable File execution flow1. User login Normally, will be loaded from/etc/profile to/ETC/BASHRC2. User non-normal login [not login Shell], such as through the SU Switch user, will start from/ETC/BASHRC, and finally to/etc/sysconfig/i18nV. Other environment variable configuration file 1. ~/.bash_logoutThe environment variable configuration file, which is in effect at logoff, is not normally used, and the commonly added commands
Http://baike.baidu.com/subview/849/15831672.htmHttp://en.wikipedia.org/wiki/Shell_ (computing)Common commandsCat file name output file content to basic output (screen or add >filename to another file) CB format source code chmod//change mode, change file permissions CP copydate current time and date echo $ABC after the variable assignment, only You need to precede the variable with a $ reference. Lint Syntax checker ls dirman helpmore typedu view disk space Status PS view current process status
environment variablesSign in to run a command or scriptFiles for bash classesSetting Local VariablesDefining command aliasesHow the login shell reads the configuration file/etc/profile--->/etc/profile.d/*.sh---> ~/.bash_profile-->~/.bashrc-->/ETC/BASHRCNon-sign-on shell~/.bashrc-->/etc/bashrc-->/etc/profile.d/*.shThe script starts a child
1. In bash, the value of each variable is string 2, view the environment variable of a process cat/proc/$PID/environ | TR ' \ s ' \ n ' 3, variable assignment 3.1, var=value, note that var = value is not an assignment operation, but an equality operation 3.2, if value contains any white space characters, you must use single or double quotation marks 4, print variables [[email protected]978]# var=value[[email protected]978]# Echo $varvalue [[email prot
with a vertical split screen, and screen is fixed dead
If you do not use the terminal multiplexing function, you can also try Tmux, you will benefit. [UPDATE: This has TUMX's most complete Enlightenment book. ]9. Synchronizing the working EnvironmentWell, in your MBP you can experience the cool shell and vim, but once you SSH into your Linux you will feel completely different, which is annoying. Fortunately, this problem can be handled synchronously
http://blog.csdn.net/shuanghujushi/article/details/51298672During the bash Shell's use, there are a number of string manipulations that are often encountered, and some of the individual usage summaries are summarized below.First, the definition of a stringYou can define a string with double quotes, single quotes, or directly after =, as defined by three stringsstr1="this is a string" str2=‘this is a string‘str3=this_isBut double and single quotes are
The first thing to know about scripting languages is that they are usually referred to as the parser for the command line interface. (from Wiki's explanation)Part I: Understanding the shellYou can see that #!/bin/sh and!/bin/bash are used here. But what's the difference between two people? There is an explanation.SH is a soft connection to bash. The full parameters of the
Learning cycle, see a lot of for,while, or until, and select with less, here is a little summary of the next select this cycle.Basic structure:Select VALUE in LISTDoCOMMANDDoneAnd the reality out of the structure is probably a number before the value, the choice of the number, is the value of the $reply, here do not know nothing, you can continue to see the following program. The $PS 3 variable is equivalent to the shell's default prompt, which is emp
Special variables$ A: The file name of the current script$num: Num is a number starting from 1, and $ is the first argument, and $ is the second argument, ${10} is the tenth argument$#: Number of arguments passed in the script$*: All positional parameters (as a single string)[Email protected]: all positional parameters (each as a separate string).$?: The return value of the previous command in the current shell process, if the previous command succeed
0]thenecho "$0:you must give one integers!" Exit 1fiif [$1-gt 0]then echo "$ is positive" elif [$1-lt 0]then echo "$ is negative" elif [$1-eq 0]then
Remember ' [' To add a space, '] ' before the space Ah ah ah.There is a prior release:Sourcehttp://linux.vbird.org/linux_server/0250simple_firewall.phphttp://tille.garrels.be/training/bash/Http://freeos.com/guides/lsst/index.htmlHttp://www.hlevkin.com/Shell_progr/hellobash.htmhttp://ww
Follow the Runoob website tutorial to learn the notesLike other languages, the shell can also contain external scripts. This makes it easy to encapsulate some common code as a standalone file. Shell files contain syntax in two forms
. FileName #也就是一个英文句号后面跟着想要包含的文件名, notice that there is a space separating the middle
SOURCE filename
While experimenting with a problem, the second file conta
, which is represented as a local variable. such as local temp=1 .Example 3. Array Parameterstest3.sh#!/bin/bash Span class= "hljs-comment" ># trying to pass a array variable function testit {local newarray # use ' local ' define a local variable newarray= (' echo " the NewArray value is ${newarray[*]} "}myarray= (1 , 2 , 3 , 4 , 5 ) echo "the original array is:${ Myarray[*]} " testit $myarray Test:sh test3.shOutput:The original array is:1,
dual-Branch if statement: if judgment condition; then s Tatement1 ... else statement3.. Fi exit: Exit script file Test:-E file: Test files for existence-F file: Test file is normal FILE-D-File: Tests whether the files are directories-r file: The test file is readable- W File: Test whether the file is writable by the-X file: whether the test file can be executed bash-x test script stepping to see if there is a syntax error multi-branch if statement:
variable does not exist, so it only outputs aWe directly a=111 this to define a variable that will only take effect in the current shell, and if we enter a child shell, it will not be found, then he is a local variable. Local variableExport a=111 This defines a global variable that the child shell inherits from the parent shell.Several configuration files for fo
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.