$J"ExitWrite a script:1, add ten users user1 to user10, password with the user name, but requires only the user does not exist in the case can be added; Extended:Accept a parameter:Add: Adding user user1. User10Del: Delete user user1. User10Other: ExitAdminusers User1,user2,user3,hello,hi!/bin/bashif [= = = "Add"];thenFor I in {1..10};d oIf ID user$i >/dev/null;thenecho "user$i is exist"ElseUseradd user$iecho "User$1" | passwd--stdin user$i >/dev/nullFiDoneelif [= = = "Del"];thenFor I in {1..10
ASC --Ascending order according to the weight of the table (light in front, heavy in the back) ASC (Ascending) Select *from xueshengxinxi ORDER BY Tizhong Desc --descending order according to the weight of the table (heavy after, light in front) desc (descending) Select *from Xueshengxinxi ORDER by nianling Asc,shengao desc --Sort by age in the table when you encounter the age value you want, and then you sort the values in descending order by the height condition. Select name from Xueshengxinx
include the done line, and then take: for the delimiter, extract the third column[email protected] ~]# cat Text.log FAILD:SUCCESSFUL:DONE:CRITICALFAILD:SUCCESSFUL:NO:GOODFAILD:NO:DO: Qingyunsuccessful:done:critical::critical[[email protected] ~]# cat Text.log |grep-e "(successful| Faild) "|grep-v" Done "|cut-d": "-f3nodo[[email protected] ~]# cat Text.log |grep-e" (successful| Faild) "|grep-v" Done "|awk-f ': ' {print $} ' nodo[[email protected] ~]#This article is from the "Chauncey" blog, make
";If the file is a directory, it is displayed as "directory";If the file is a linked file, it is displayed as "symbolic file";Otherwise, it is displayed as "unknown type."#!/bin/bashif[!-e$1];thenecho "FILENBSP;NOTNBSP;EXITNBSP;." exit5fiif[-L$1];thenecho "Symbolicfile." elif[-d$1];thenecho "directory." elif[-f$1];thenecho "Regularfile." elseecho "Unknowntype." Fi run Result: [[Emailprotected]test]#sh20.sh/etc/directory. [[emailprotected]test]#sh20.sh/etc/rc.d/rc1.d/k92iptables symbolicfile. [[
Basic Linux commands exercise:1, create a new user without home directory OpenStack;#useradd-M OpenStack2 , copy/etc/skel to/home/openstack;#cp-R/etc/skel/home/openstack3, change/home/openstack and its internal documents belong to the main group are openstack;#chown-R Openstack:openstack/home/openstack4,/home/openstack and its internal files, belong to the group and other users do not have any access rights;#chmod-R go=/home/openstackThis article is from the "Learn Linux history" blog, please be
1, job Description:4 primary partitions. Implementation process: Open Linux, enter in the terminal:FDISK-UC/DEV/SDAcan view: Command (M for help): Enter:n----New partitionappears: Command actione extended----Extended partitionp Primary partition (1-4)input: p----Primary partition appears: Partition Number (1-4): Input: 1----The ordinal of the partition, i.e. the first partitionthen enter the size you want to assign to the partition in the command that appears. Note:Partition:Primary partitio
Requirements: A total of more than 300 machines, write a script to automatically clean up these two types of machine log files. In the Fortress machine batch release, also want to batch publish to crontab inside.Class A machine log storage path is very uniform, Class B machine log storage path needs to match with * (because this directory in addition to the log, there are other files, can not be deleted.) *.log available when matching)Class A:/opt/cloud/log/deleted 7 days agoClass B:/opt/cloud/i
1. Show current time and dateSystem time[[Email protected] ~]# DateSunday, June 11, 2017 01:17:55 CSTHardware time[Email protected] ~]# HwclockJune 11, 2017 Sunday 09:12 21 seconds-0.994224 seconds2, set the current system time is June 6, 2018 06:06Set Current system time[[email protected] ~]# date-s ' 2018-06-06 06:06 'Wednesday, June 06, 2018 06:06:00 CSTSet Current hardware time[[email protected] ~]# hwclock--set--date= ' 2018-06-06 06:06 '[Email protected] ~]# HwclockJune 06, 2018 Wednesday
I haven't written a blog since the Blue Bridge Cup. Today, the third chapter of the previous part of the problem of the answer to fill.3-4 adding integersThis topic has the hint, said chooses the appropriate input way, can simplify the question. I didn't think of Cin at first, and the result was a string, and I remembered Cin, thanks to someone reminding me. Shame on you.#include 3-5 rotate the character matrix counterclockwise by 90 degrees#include 3-6 binary conversion (converts decimal to oth
One: TopicReverse-Print the data in a single-linked list, assuming the pointer points to the start node of a single-linked listSecond: Ideas1. You can use the recursive method to print data2. You can use the array space, get the length, reverse print array3. If you can, the linked list data using the head interpolation method, reverse order, and then the positive sequence printing canThree: Algorithm implementation (here use method one: recursive implementation is easy to understand)#define_crt_
One: What is the whole arrangementArrange: From the n elements of any m elements, and in a certain order to arrange, called permutation;Full arrangement: When N==m, it is called the whole arrangement;For example: The full arrangement of the set {----* *} is:{1 2 3}{1 3 2}{2 1 3}{2 3 1}{3 2 1}{3 1 2}We can draw a graphical representation of this permutation, that is, arranging enumeration trees, such as the enumeration tree for the arrangement of {-i}, which is exactly the same as the algorithm w
/* Simple Select Sort */public class Simplesort {public static void main (string[] args) {int[] Arraydata = {5, 9, 6, 7, 4, 1, 2, 3, 8}; Simplesortmethod (Arraydata); for (int integer:arraydata) {System.out.print (integer); System.out.print ("");}} /* Time complexity: Because it is a double-loop solution, it is O (n^2) * Spatial complexity: the size of the temporary space used is a constant, not related to N, so the spatial complexity is O (1) * Description: * In fact, the sort of bubble is ba
#!python3#9.8.1#遍历目录树,查找特定扩展名的文件(自定义)#and把查找到的文件,copy到新文件夹import os,shutilfile_dir=input("输入要查找的目录:")file_dir=os.path.abspath(file_dir)file_list=[]if not os.path.exists(file_dir): print("目录不存在")else: file_type=input("输入要查找文件类型的扩展名(如.pdf或.jpg):") file_type=file_type.lower() for folder,subfolders,files in os.walk(file_dir): for fi in files: if fi.lower().endswith(file_type): file_list.append( os.path.join(folder,fi))#复制destination=input("输入要存放文件的目录:")destination=os.path.abspath(destination)if not
An array is a combination of data of a data type. An entity in an array is called an element or member of an array.Example one: creation and extraction of dataExample two: How to create and assign an arrayExercise One: Enter the age of nine people into an array from the consoleExercise two: Seeking the sum of agesExercise three: Seeking the sum of Ages, method twoExercise Four: Enter the number of classes, according to the number of people to enter the results, to find the average scoreExercise
have the ' K1 ' key, create the ' K1 ' key and its value (the value of the key is set to an empty list), and the index in the list Li is an odd-numbered element that is added to the empty list of the ' K1 ' key.If the dictionary has the ' K1 ' key and the K1 corresponding value is a list type, then the index in the list Li is an even-numbered element that is added to the value corresponding to the ' K1 ' key.Li = [All-in-a, ' a ', ' B ', 4, ' C ']LI1 = []DiC = {' K1 ': li1}If ' K1 ' not in dic:
1 Public classTest012 {3 Public Static voidMain (String[]args)4 {5 /*6 7 three questions if you see it, remove the comment.8 //The result is 0, what is the use of I in this? 9 Ten One int total=0; A for (int i=0;i>total;i++) - { - System.out.println (i); the } - System.out.println (total); - - + */ - + A /* at - //Why do you get this result i=50, I think is i=10? - - - int i=10; - if (i in i=50; - System.out.println ("i=" +i); to + */ - the /* * //Why will i=11, I think is 9 ah???
. Only the top three pages of the crawl, 30 vendors per page are shown here.3. Using the regular Fetch URL4. Crawl results saved in the Script sibling directory ' butian_company_url.txt ' file, if not enough 90 URLs, may be some vendors did not fill out (ie empty)Import Requests,re,json,timehead = {' user-agent ': ' mozilla/5.0 (Windows NT 6.3; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/43.0.2357.130 safari/537.36 '}cook = {"Cookie": "Write here your cookie for the day you log in"} ur
# Continue's role jumps out of the loop to perform the next loop# Else function is to print a line on the finish of the while print# end= () No Line breaknum = 0While Num Num+=1 If num ==3: Continue #continue function out of the loop to perform the next loop Print (num)Else Print ("00000000000", end= "") Print ("11111111111", end= "")Python Looping exercises
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.