Shell script case (ii) bulk delete users

Case-then the previous caseWant to bulk delete all users created in the previous caseScript Show: (Next time explain)#!/bin/bashecho > userlist.txt;for i in `seq 50`do id student$i >/dev/null 2>/dev/null; [ $? -ne 0 ] && echo -e "[\033[31merror\033

Shell Scripting Exercises

1, write the script/root/bin/createuser.sh, to achieve the following functions: Use a user name as a parameter, if the specified parameter of the user exists, it will show its existence, otherwise added; Displays the ID number of the added user and

Shell Programming (1)

I. Review exercisesGeneral wildcard charactersCurly Braces {}Inverted quotes, single quotes, double quotesoutput redirect > >>Enter redirection User-defined variablesTwo shell command exercises(1) The use of the following documents is briefly

Shell periodically transfers log files to cloud disk and periodically deletes cloud disk files

The shell script is processed periodically as follows: Cat /home/backup/logs_delete. SH #!/bin/bash/bin/find"*.log*" -mtime +4 -type f| Xargs mv {}/mnt/logs/nginx//bin/find"*.log*" -mtime +30 -type f| Xargs RM-L04 * *

Use of function functions for shell scripts

Use of function functions for shell scripts? The basic things in front of the introduction, the following we introduce the function how to use.? Note: The function needs to be declared before it can be used.? The declared keyword can be used with

Shell file expression

file Expression-e filename true if filename exists-d filename If filename is a directory, true-F filename True if filename is a regular file-L filename True if filename is a symbolic link-r filename If filename is readable, true-W filename if

Experimental three---shell programming

In addition to being an interpreter, the shell is a high-level programming language with variables, keywords, and a variety of control statements.Command historyHistory displays a list of historical commands, including its ownHistory 50 shows the

Use shell scripts to telnet to the server and modify the Saltstack configuration and restart the service

recently, the company added 40 servers for the last active function, although the server can be managed by saltstack (automated operations Tools Saltstack), the project can be released through Jenkins + Saltstack (using jenkins+ Saltstack+sh deploy

Experiment three, Shell programming

first, the contents of the experiment1. Practice command history, aliases, and special character usages in the shell (4th. 4.2, Section ~4.5)2. Shell command application exercise (see Experimental steps)3. Write a shell script that executes in 4

Pipe and job control, shell variables, environment variable configuration files

Pipe character and job control | Give the result of the previous command to the following command processing.[[email protected] ~]# cat 1.txt |wc -l 统计行数5[[email protected] ~]# cat 1.txt |grep ‘aaa‘aaaa 剪切出aaa的行 CTRL Z pauses a task,

Basic Shell Command 1

1. List of files and directories 1.1 more common Linux top-level virtual directory names and their contents: Directory Use / The root directory of the virtual directory. Files are not usually stored here

Shell file lookup and compression commands

Locate command1.locate filenameFuzzy match as long as the file name contains the keyword can beNon-real-time lookup, faster than find.Rely on index database/var/lib/mlocate/mlocate.dbAutomatically run once a day to update the database.UpdateDB

Shell Variable Introduction

Variable naming rules变量名必须以字母或下划线开头,名字中间只能由字母,数字和下划线组成,大小写是区分的变量名的长度不得超过255个字符变量名在有效的范围内必须是唯一的在Bash中,变量的默认类型都是字符串类型"用户自定义变量" ? ?变量自定义的"环境变量" ? ?这种变量中主要保存的是和操作环境相关的数据。变量可以自定义,但是对系统生效的环境变量名和变量作用是固定的。"位置参数变量" ? ?

Shell Programming Basics: logical Operations

Recently around here for a long time ah, now reluctantly come out, share a little understanding of their ownExit statusA program once run must have only two kinds of results, either success or failure, the result of success is the same, the reason

Shell's enterprise practical work case

Case one:Monitoring Web Site Directory ( /var/html/www ) If all files are tampered with (the contents of the file have been changed), if there is a file name (e-mail) to print the changes, the scheduled task every 3 minutes to execute onceMonitoring

Process Control of Shell script programming

1. Unlike Java, PHP and other languages, SH's process control is not empty, such as (the following is the PHP Process Control notation):You can't write this in Sh/bash, and if the Else branch doesn't have a statement execution, don't write this else.

Write a simple alarm system with the shell

Write a simple alarm system with the shell Create a directory structure mkdir -p /usr/local/sbin/mon/{bin,conf,shares,mail,log}mon //主目录bin //主程序目录shares //子程序目录mail //发邮件目录log //日志目录Program Main entry

Shell Script--Initial CGI

CGI according to the definition of Baidu Encyclopedia, as follows:CGI is the specification of external programs when the Web server is running, and programs written by CGI can extend server functionality. CGI applications can interact with the

Shell exercise (Key-free login script)

#!/bin/bashremote_ip=$1if[!-N" $"] ; Then Echo "Please usage./without_password remote_host!"Exit1Else Echo "The remote_host you input is $remote _ip"fiSSH[Email protected] $remote _IP"mkdir. ssh; chmod. SSH"Ssh-keygen-t RSASCP~/.SSH/id_rsa.pub

Shell Special Symbols

1. Special symbolsFor more information, see2, about the pipe character(1), cut split-D delimiter-F Specify segment number-C to specify the first characterFor example, see,Example, | Output, cut splits out the desired results later. In general,-C and-

Total Pages: 541 1 .... 242 243 244 245 246 .... 541 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.