Label:Lvy Teacher Teaching Program, as well as a substitute shell part of the course, we all feel that the teacher does not work, the operation of the class is wrong, I think her foundation is not good. Moreover, she could not explain the reason, the student asked why, she did not know. Crash. To the XX training institutions after the reaction, said the teacher project experience, but if a person foundation is not, do more projects also no use Ah, all
/hostname/histsize, etc.)You can see it in the/etc/profile.Read/etc/profile.d/*.sh (color language instruction alias)~/.bash_profile,~/.bash_login,~/.profile (only one of them can be read sequentially)~/.BASHRC (called in ~/.bash_profile),/ETC/BASHRC (called in ~/.BASHRC)Any one read succeeds and no longer reads the nextThe respective home directories are only valid for eachAfter the modification succeeds, source reloads the scriptNon-loginA shell tha
One, bash internal variables:
Common internal commands: Echo,eval,exec,export,readonly,read,shift, wait,exit, and Dot (.) are also the source commands.
Command
function
Echo Variable Name
Displays the variables specified by the variable name table to the standard output
Eval
Reads a sequence of parameters, and then executes according to the characteristics of the parameters themselves.
[[: Lower:]] all lowercase characters[[: Upper:]] all uppercase characters[[: Alpha:]] all uppercase and lowercase letters[[:d Igit:]] All numbers[[: Alnum:]] numbers and uppercase and lowercase[^] matches any single character outside the specified rangeExample #ls[[:alpha:]]*[[:space:]]*[[:alpha:]], displaying a file that starts with a letter and ends with a letter and contains spaces in the middleThe type of shell that stands in terms of user loginL
files under the/source/directory directory are compressed and decompressed, and quickly move all the way to the/dest/directory directory, which is in/source/directory and/dest/directory There is a special advantage when you are not in the same file system.
Conditional statement (note: spaces, quotes, equals) on both sides of the conditionIf ["$var" = "abc"]; Then
...
elif ["$var" = "AC"]; Then
...
Else
...
Fi
For loopFor Var in $ (LS *.sh); Todo
Echo $var
Done
While loopVar=1
While
for different old and new versions of the same file, compared in behavioral units2#用法:diff[-bbi] from-fileToFile #比较from-file and to-file and output a different place3#CMP: Compare in ' bytes '4#用法:CMP[-S] file1 file2 #按字节比较file1和file2, and outputs the first difference found, plus-s outputs all the different points5#Patch: Withdiffco-authoring patch files and upgrade files6 #用法:7$diff-naur Oldfile newfile >Patch_file #通过比较新旧文件制作补丁文件, Patch_file usually with a. Patch suffix8$Patch-PN Patch_file
Login:
Bash executes/etc/profile first and then calls ~/.bash_profile.
Cancellation:
Bash calls ~/.bash_logout.
Execute the new shell:
In desktop management programs such as KDE,GNONE,ICEWM, execute terminal programs or perform manual/bin/bash, or invoking the she
command-line mode: For I in {1..10};d o echo $i;d one =========================================== while loop statement usage while condition to meet cond Ition executes the cmd do-cmd-done bash-x to run the script in debug mode to display the script's running process until loop statement usage: Until condition--G
t; does not satisfy the condition, then executes the cmd do cmd-done case multi-conditional Judgment Statement usage: Case value in va
Starting today to learn shell programming, when the university learned c,c++, compilation, but long forgotten, I think the algorithm is done, what language is just a tool. Learning here, the class of students, especially a little did not touch the programmer, really very difficult, and the teacher here also out of some tidbits ...Originally taught our teacher cold, the voice is dumb, so let's teach our proj
Linux File SystemLinux speaking files are stored in a single directory structure (virtual directory), and the virtual directory contains the file paths of all the storage devices installed on the PC.The more complex part of the Linux virtual directory is how it coordinates the management of each storage device. The first hard drive installed on a Linux PC is the root drive, creating some special directories on the root drive that we call mount points. Mount points are directories in the virtual
Daniel RobbinsPresident and CEO, Gentoo Technologies, Inc.March 2000
By learning how to program using the bash scripting language, you can make the daily interaction of Linux more interesting and productive. You can also use the familiar and favorite standard UNIX concepts (such as pipelines and redirection ). In this three-part series, Daniel Robbins provides an example of how to program using
One:The shell is the shell of the Linux/unix system, and it can be understood as the command line interface, where you enter and execute the command line.Bash (born again shell) is one of the shell's most commonly used shells. you run on your Linux: PS | grep $$; If you run the result as bash, it means that the current
basis for many derivative shells, many of which are now applied in typical Linux systems. Figure 1 demonstrates the series of important shells. Bourne shell leads to the development of Korn shell (ksh), almshells (ash), and popular Bourne Again shell or Bash. C shell (csh)
Set bash options with built-in set and SHOPT commandsThe set command can be used to customize the shell environment, using the option "O" to turn options on or off. For example, open the options: Set-o option, close the Select item: Set +O option.For example, to open the VI Interactive command-line edit, the following:
[Email protected] ~]#Set-o#查看当前设置情况Allexport offBraceexpand onEmacs onErrexi
Bash internal variable learning and Bash variable learning
$ SECONDS variable --------- number of SECONDS after the script has been run. Script instance:
1 #!/bin/bash - 2 #=========================================================================================== 3 # 4 # 5
Learning bash notes-input and output, bash hide output1. I/O redirection
The I/O redirection is as follows:
Cmd1 | cmd2: pipeline that receives the standard output of cmd1 as the standard input of cmd2.
> File: redirects standard output to file.
> File: redirects the standard output to file. If the file exists, it is appended
> | File: Even if nocl
configuration will be very troublesome. Even the X-Window Interfaces set by different release versions are different, and learning is also difficult. In addition, the text interface transmission speed is relatively fast during remote connection.The most important thing is that it gives you a better understanding of Linux. As a general user, only learning the operation interface can solve the vast majority
************************************************************************* * * * Original:blog.csdn.net/clark_xu Xu Changliang's Column************************************************************************? time to read the file#!/bin/bashFor file in ' Ls/root 'DoStat $file >1.txtSed-n "7p" 1.txt>2.txtUsetime= awk-f ":" ' {print $2.txt} 'echo "Time=" $file $usetimeDone? reads each line of the file while statement. Cat Afile | While Read onelineDoEcho $onelineDone? reads each line of the file
Bash shell Script Introduction Shell Runtime EnvironmentIf you're running a Unix or Linux system, such as Ubuntu,red Hat,suse Linux and MacOS, it's built-in bash shell, so you don't need to configure the so-called development environment.My
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.