manipulating databases with Shell commands

Use the-e parameter of MySQL can perform various kinds of SQL (create, delete, add, erase, change, check) and other operationsUsageMysql-uxxx–pxxx-e "MySQL Command" Of course, you can also use the following notation MYSQL-E-uxxx–pxxx "mysql

Shell combined with expect for automatic password entry

Shell combined with expect auto-input Password example1#!/bin/Bash2 3cd/data/Live4 5/usr/bin/expect EOF6Spawn git clone"ssh://xxxxxxxxxxxx"7Expect"*passphrase*"8Send"passwordhere\n"9 expect EOFTen EOF One A Time= '/bin/Date "+%y%m%d%h%m%s"` -CD

Shell Bulk Add Users

#!/bin/bashRead-t 30-p "Please input user name:" NameRead-t 30-p "Please input user number:" numRead-s-T 30-p "Please input user password:" PassEcho-e "\ n"if [!-Z "$name"-A!-Z "$num"-A!-Z "$pass"]ThenY=$ (echo "$num" | sed-e ' s#^[0-9]# #g; s#[0-9]*

Linux Shell common Commands

For loopapplist= (App1 app2 app3); for apps in ${applist[@]};d o echo $app;d one; Get IP AddressIfconfig |grep-po ' (? Ifconfig|awk-f "[:]+" ' $4~/[0-9].+[^0-9]+/{print $4}/lo/{exit} 'Ifconfig|sed-nr ' s/^[[:space:]]+inet addr: (. *) bcast.*/\1/p '

The shell uses shift to get a bit after the entry

Sometimes the shell has a variable number of arguments, want to get the 2nd bit after the argument, as a new entry to invoke other scripts the usual way to think of this is to use traversal, for example, the following method:For ((i=2;i DoEcho $i

Shell all built-in commands

Reference from Linux command DaquanTo see if the shell command is a shell built-in command, use the type to determine: $ Type cdCD is a shell builtin$ Type pingPing is/bin/ping All built-in commands are as follows:ShThe

Problem resolution for password input in shell scripts for sudo, etc.

One, do not want to manually enter the method1. Install expect tool: sudo apt-get install tcl TK expect2. The contents of the script file are as follows:#! /usr/bin/expectSpawn sudo apt-get updateSend "zhoushuo\r"InteractSecond, want to manually

Shell uses shell scripts to publish the project

The first time to write shell scripts, no experience, is to write directly, or to go through the process ( ̄▽ ̄) ~*-----------------------------------------------------------------------In general, three steps, let's do it with me.---------------------

Linux Shell Types

One: The type of shell that stands in terms of user login:Login Shell: Normal usually a terminal login Su-usernamesu-l USERNAMEOpen Command Window under non-login SHELL:SU username graphics terminalTwo: Bash configuration file:Global

Shell configuration file

Personal configuration is mainly concentrated in the ~/.profile file.When you open a new interactive shell, the order in which the configuration files are executed is/ETC/PROFILE/ETC/BASHRC ~/.profile and finally ~/.BASHRCEnvironment variables--can

Shell reads each line of the file

Shell reads each line of the fileWriting one:----------------------------------------------------------------------------#!/bin/bashWhile Read lineDoEcho $lineDone ----------------------------------------------------------------------------Two:------

Linux Shell Basics

DirectoryFirst, Shell Basic use of scripts1. Language Specification2. Variables3. Redirect (>,>>)Second, operators and common judgments1. Comparison operators2. Logical operators3. Common JudgmentsThird, the program structure1. Branch (if statement)2

CentOS assigns IP script--The first shell script written

IDC small rookie one, non-trained. There are often customers with CentOS servers that need to allocate 15 IPs or even 30 IPs. Each time a manual assignment was cumbersome, it took a day to learn the shell script and write the

In shell programming if the path name encounters parentheses

In Linux, if the file name is enclosed in parentheses, the parentheses should be processed first, preceded by "\" before "(" and ")". Bracket_handle gives the processing method:Sub Bracket_handle {My ($tmp _name) = @_;$tmp _name =~ s/\ (/\\\ (/g; # (

Linux custom Shell functions and function libraries

Under the Linux system, Shell scripts can help us in a variety of situations, such as displaying information, even automating specific system administration tasks, creating simple command-line tools, and so on.In this guide, we'll show Linux novices

Case commands in the shell

The case statement and the judgment statement [If...elif...else] function similarly;When logic is relatively simple, the code is much less than the latter.Case usage, use a variable to match a value, if the match succeeds, execute the command below

Shell instance (i)

Shell instance (i) Example one: equals-eq (equal)Unequal-ne (not equal)Greater than-GT (greater than)Smaller than-lt (less than)Greater than or equal to-ge (greater than or equal)Less than or equal to-le (lesser than or equal)Examples

Linux Base-shell Script

Task one goal: Automatic deployment, initial configuration, and start Nginx reverse proxy serviceSplit the task-the Automatic Deployment section is the first to download the installation NginxFirst, create a very NB-domineering catalogue and a

Shell Basic Syntax 2

Automated deployment and monitoring of development scripts1. Scripting automatic deployment of reverse proxy, web, NFS;Requirements: I, the deployment of Nginx reverse proxy three Web services, scheduling algorithm using weighted polling;II, all Web

Fundamentals of algorithm and Shell scripting programming

Bash features multiple command executions, such as: # COMMAND1 $ (COMMAND2), and communication between Processes (IPC): # COMMAND1 | COMMAND2 ...I. Command execution structure and algorithmIn command execution, there are sequential execution

Total Pages: 541 1 .... 403 404 405 406 407 .... 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.