online shell scripting practice

Learn about online shell scripting practice, we have the largest and most updated online shell scripting practice information on alibabacloud.com

Shell Scripting Exercises

;CLOCR=$[RANDOM%7+31]Echo-e "\e[1;${clocr}m\e[0m\c"DoneEchoDone14, write a script, for 100 of all positive odd sum#!/bin/bashN=0For i in {1..100};DoIf [$[$i%2]-eq 1]Thenn=$[$n + $i]FiDoneecho "Sum= $n"15, write a script, prompted to enter the network address, such as 192.168.0.0, determine the input network segment host online status, and statistics online and offline host how much#!/bin/bashf=mktemp /tmp/

Shell scripting in Linux-arrays, advanced string manipulation, advanced variables, configuring user environments

Overview:Overview:This section describes the array of shell scripting in Linux, advanced string processing, advanced variables, and configuring the user's environment.One, function and positional parameter extension1. TheShift command implements the jump in the position parameter, which squeezes the leftmost parameter650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/86/5B/wKiom1e9EFvAun-AAABG0xL4ac

Shell Scripting Normalization, standardization

1. Write more comments in the script This is a recommended practice that can be applied not only in shell scripts, but also in all other types of programming. commenting in a script can help you or others to read your script Learn about the different parts of the script. Comments are defined with a # number.2. when the script exits when the run fails Sometimes, even if some commands fail, bash may c

Shell Scripting Encryption

First, Background introductionDBA Daily Update Insert|update More, delay a lot of time. The development of tools, although the user password in the script encryption and strict operation, but carefully query internal logic or may reveal the password, today, using Gzexe method to encrypt the shell script.Second, start testing1. Find a test script to execute. (The online script content is inconvenient to publ

Shell Scripting Exercises

and so on one by one corresponds; case $MENU In Jiaozi) The echo "Your Choose is $REPLY" # # variable REPLY dedicated to storing the results of user input echo "$MEN U Price is 20 ";; Lamian) echo "Your Choose is $REPLY" Echoes "$MENU Price is 15";; Mifan) echo "Your Choose is $REPLY" Echoes "$MENU Price is 18";; Daoxiaomian) echo "Your Choose is $REPLY" Echoes "$MENU Price is 12";; Quit) echo "Your Choose is $REPLY" break;; *) echo "Your Choose is $REPLY" echo "Choose a

The SED of Shell scripting learning

In the process of writing shell scripts, we often need to process text files using the SED flow editor and awk. First, what is SED?Sed is an online editor that processes a single line of content at a time. SED is a non-interactive editor. It does not modify the file unless you use Shell redirection to save the results. By default, all output lines are printed to

Shell Scripting Practices

Common shell scripting use cases, from the online reference and after the modification of the work, in addition to the wiki in the company to write records, it is necessary for a blog to record a drop.Combat Problem 1:Use the For loop to create a batch of 10 files in the/oldboy directory, with the name in turn:Oldboy-1Oldboy-2......Oldboy-10Answer:[[Email protect

Shell Scripting Raiders (learning notes)--1.6 math and BC commands

requires the output on the screen to be "1+2+3+4+5+6+7+8+9+10= calculation results", which is a good example. [[emailprotected] tmp]# echo $ (seq -S " + " 10 " = ' seq -S " + " Ten | BC " 1 +2 +3 +4 +5 + 6 +7 +8 +9 +10 = 55 Echo $ (seq"+") =$ (('seq'+ "ten"))1+2+3+4+5+6 +7+8+9+Ten=[Email protected] tmp]#Echo$(seq-S"+" Ten)=$(seq-S" + " Ten|Xargs Expr) # Note"+"And" + "1+2+3+4+5+6+7+8+9+Ten= -Back to series article outline:http://www.cnblogs.com/f-ck-need-u/p/7048

Shell Scripting Learning

. if[ "$difdate" ==0];thenecho "Happybirthday" toyou! " #今天过生日elif [ $difdate -lt0];then echo "andhave$ ((-$difdate +365)) daystolive." elseecho "andhave $difdate Nbsp;daystolive. " The main thing is to use the date command to add and subtract dates, through the Read command to enter the birthday, the only thing to note is the conversion into a number of days after the subtraction will appear "value too great for base" This error, the online data sai

Shell Scripting Exercise 1

Tags: Configuration ideas nbsp Script Practice post awk bash judgment comparison#!/bin/Bash while : DoRead-P">>>"user [["$user"="Q"]] || [["$user"="Q"]] Break [[-Z $user]] ContinueID$user >/dev/NULL [[ $? -eq0]] Cat/etc/passwd|awk-F:'{print $, $NF}'|grep$user | |Echo "User not exist" DoneThe script implements the target to determine whether the user existsMain ideasThe while do statement implements the loopAdd variable $user exit mechanism use "| |

Shell Scripting Learning notes-logical operators

the same as [].(4) between multiple [] and multiple [[]], or any of the mixed intermediate logical operators are or | |.1.5 General Examples:(1) Compare the size of the two integers by defining variables, script arguments, and read-in in a conditional expression (prohibit using if) and alerting the user to the results in the form of a screen output. A total of 3 scripts developed, when using script to pass the parameter and read in the way you need to be a variable is a number, and not to give

Shell Programming service scripting, file lock, and signal capture

-interactive editor, and SED is suitable for editing files in scripts because Vim cannot be used in scripts. Sed the main usage of the increase and deletion of the search, this can see the man manual, there is a lot of practice. Tomorrow I will provide an sed file that will summarize all the uses of SED basically. I hope you will pay attention!Summarize:Today mainly on the shell

The most basic shell scripting

First, the basic writing process of the practice script:1. Determine the task and the command to complete the task2. Scripting Integration Tasks3. Authorization and test executionSecond, exercise:A. First I create a directory, put the script we write into, so it's not too messy[Email protected] ~]# mkdir-p/root/bin[Email protected] ~]# Cd/root/binB. Start compiling below[Email protected] bin]# VI sysinfo.sh

Shell Scripting Exercise A

ifMulti-branch statement practice#!/bin/bashread-p " Please enter 100 m running seconds: "IIf [$i-lt] [$i-GT 0]Thenecho " Enter the final "read-p " enter male and female "aif [$a = male]Thenecho " into the men's group "elif [$a = female]Thenecho " Enter the women's group "Elseecho "Error"Fielif [$i-ge 10]; Thenecho " elimination "Elseecho " Error "Fi Case Statement Practice, automatically unzip the compre

Shell Scripting Learning Notes (normal form)

Fgrep. These return values make it possible to perform aself-initiated text processing. I used the Egrep tool in the example above. is the extension of grep, a lot of other ways to use this tool and the above introductionSome of the inadequate places you can go to the encyclopedia to find out, in fact, some of the more advanced tools also support this expression. I'll be in the knot.The blog is again introduced.I personally think that the rote of these characters is inappropriate. We should le

Ping a network segment of signal capture and function practice scripts in shell scripts under Linux

The main purpose of the script is to practice capturing signals in a Linux bash script, by practicing the use of functions, and by terminating a running program, subsequent processing of files opened by the program, and so on!Scripting Features:Ping IP within a network segment, detect which IP is online, which IP is not onlinecommand to

Ping a network segment of signal capture and function practice scripts in shell scripts under Linux

The main purpose of the script is to practice capturing signals in a Linux bash script, by practicing the use of functions, and by terminating a running program, subsequent processing of files opened by the program, and so on!Scripting Features:Ping IP within a network segment, detect which IP is online, which IP is not onlinecommand to

Use Shell to solve real-world enterprise problem case practice

the total cost of each consultant admission sum. No less than 2 ways to implement, the processing of the field name removed!!!Hint: The answer is similar to the following: The process or test you first, exercise it.650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/75/FE/wKioL1ZHKI_xrp6nAABpA5H18_w297.jpg "title=" Snap11.jpg "alt=" Wkiol1zhki_xrp6naabpa5h18_w297.jpg "/>What, no? You can refer to the following course and have the same questions in detail.easily master the awk array Enter

Compile a simple online Shell Command Interpreter

Project name: Online Shell Command Interpreter Objective: To practice socket programming Function: You can use Windows telnet to remotely log on to the Linux system, run your own shell command parser, and perform some simple internal and external commands, the operation commands and running results are displayed

Shell script and Ansible practice MARIADB source code compilation automatic installation

Tags: mariadb compiling and installing shell Automation Ansible Project PracticeIn the previous blog has been demonstrated, through scripting MySQL Universal binary installation, the following through the demonstration script to implement the source code compilation MARIADB Automation, in large-scale deployment of multiple mariadb, where the use of ansible to implement its automated deployment, Can greatly

Total Pages: 3 1 2 3 Go to: Go

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.