In my resume, I wrote that I am familiar with common Linux commands and can do shell programming, so it is necessary to learn shell programming.Read the catalogue:
First, Shell and bash
II. structure and execution of shell scripts
UI Items Delete useless strings in the "UIL" file:The script needs to develop a TXT file for the UIL file directory location & useless string, such as deleting a useless string from the Haier directory:./delete_uil_string.sh.
In the shell script, the color control is often used as followsFormat:" \033[Word background color; text color m string \033[0m"eg" \033[41;36m something here \033[0m"Where 41 of the position represents the background, 36 of the position is the
Who commandThe WHO command is to display the user information of the current login system, execute the WHO command to know which users are currently logged into the system, execute the WHO command separately to list the login account, the terminal
(a) Print a menu, accept an input, if there is no user to create a user and password, will create a user and password to write to a file, if there is a file to impersonate a user to log in, require the user name arbitrary, can be (^$ ^q), the
When using the shell, the environment variable file is read./etc/profile: This file sets the environment information for each user for the system, and the file is executed when the user logs on for the first time.and collect the shell settings from
Case 1: variables, functions, judgments, comparisonstest.sh[JavaScript]View PlainCopy
#!/bin/bash
Echo ======================== This is a bash demo========================
printf "%s is%d years old \ n" Zhengjinwei
DECLARE count=10
The shell generates 100 6-bit random numbers in a number of ways:Here's a script that reads:650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/06/AF/wKiom1m8Ax-wV92tAAA8Jft99zI996.jpg-wh_500x0-wm_ 3-wmp_4-s_3612996601.jpg "title="
calculate the front of a specific directory Ten a large fileIn a given directory, want to know which large files exist, take the top 10, by file size ranking(1) , using awk to achieve#!/bin/bashPath=/root/shellFind $path-type F | awk ' {Var=$0"Ls-l"
(character) Expandeach time you enter a command, and then pressEnterkey, inBashbefore you execute your command,Bashwill be on the inputThe character completes several steps of processing. We already know two or three cases, how a simple sequence of
1:t= "ASDASD sdasd"Defined variables typically have strings and numbers ${t} and $t use variables2:o= "Sdfjkflsjl SDKAFJLJKDASL ${t}"echo o print variable echo $o $t link variableBasic operation can refer to the hand, as the script is easy to
1, the first line must be #! /bin/bash#! indicates that the script uses the following interpreter to interpret the execution2. Echo Print outputFor example echo "Hello World" > Aa.txt 3. Receiving parameters#!/bin/bashName=$1Age=$2Sex=$3echo "Name:
I. What is a script (scripts)A command file that installs a logical relationship record, in which the file name can be used to initiate the execution of a command within a script, and the shell script is an explanatory language that requires an
The specific meaning of the prompt can be consulted: http://billie66.github.io/TLCL/book/zh/chap14.htmlUbuntu16.04 personal configuration as follows, for later review1 functionGit_branch {2branch= "' Git branch 2>/dev/null | grep "^\*" | Sed-e "s/^\*
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/9E/D1/wKioL1mWuEXjPgg_AADSEroFgqw866.png "title=" Shell programming--$ The meaning of the number. png "alt=" Wkiol1mwuexjpgg_aadserofgqw866.png "/> $* Same as the general directive,
Shell Requirements: Write a scriptOne, add 10 users user1 to User10, password with the user name, if the user exists, but requires only the user does not exist in the case can be added, in the format of/useradd.shSolution ideas: 1. Use the FOR Loop
Show VariablesThe read command reads a row from the standard input and assigns the value of each field in the input row to the shell variable#!/bin/shread name echo "$name It is a test"The above code is saved as test.sh,name to receive the standard
DescriptionThis is a note about http://c.biancheng.net/cpp/shell/.Shell StringStrings can be in single or double quotes, or without quotation marks.1 #!/bin/bash 2 3 # #字符串 4 5 #不加引号: 6 #无法出现; 7 echo a 8 echo a;b 9 #单引号: One #单引号里的任何字符都会原样输出,
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