Shell scripts for database operations

MysqlMysql-h${hostname}-p${port}-u${username}-p${password}-E "SQL statement"-hlocalhost-uroot-proot customer-e "select * FROM Customer "> 1.txtReference article:Http://www.2cto.com/database/201410/343557.htmlShell Programming--eofhttp://blog.163.com/

The shell under Linux

------------------------------One of the shell versions used by Linux is the [Bourne Again Shell] abbreviated to bash. This shell is an enhanced version of the Bourne shell, developed under the GNU architecture.The first popular Shell[bourne

Shell Parenthesis Usage Introduction

Medium brackets [ and the test command equivalent, the user Boolean judgment, such as:1 a='abc'2if'abc' ] 3 Then 4 " Yes " 5 Else 6 " No " 7 FiEquivalent to1 if ' ABC ' 2 Then 3 " Yes " 4 Else 5 " No " 6 FiWhen using [], be

Shell (a) variable

First shell #!/Bin/bash echo "Hello world!" The "#!" fixed tag is used to specify which interpreter the script uses to parse the script and must have Execute permissions chmod+X./test.sh increased execution permissions./Test.sh executes the script

Nginx under the log cutting shell

#!/bin/bashMkdir-p/data01/nginx_log/$ (Date +%y%m%d)cp/data01/nginx_log/access.log/data01/nginx_log/$ (date +%y%m%d)/access-$ (date +%y%m%d). log#先复制原来的正常访问日志Cat/dev/null

Nginx under the log cutting shell

#!/bin/bashMkdir-p/data01/nginx_log/$ (Date +%y%m%d)cp/data01/nginx_log/access.log/data01/nginx_log/$ (date +%y%m%d)/access-$ (date +%y%m%d). log#先复制原来的正常访问日志Cat/dev/null

Getting Started with Shell programming

Getting Started with Shell programming~/.bash_history//root file path preserving the command history$HISTSIZE//History command variableSleep 100//Sleeping 100Sleep 200//sleeping 200CTRL + Z//pause command RunJobs//View tasksFG//Recall front DeskFG 2/

Variable substitution in the shell

${STR-NEWSTR} is only replaced when STR is NULL${STR:-NEWSTR} replace when STR is null or if STR is an empty stringAll in all,-number, when STR has no content, then replace,: The number just increases the case of an empty string. Note that the

Leetcode's Shell Part 4 questions finishing

Some of the details of the shell are not very familiar with, borrowed a lot of other people's Things1. Word Frequency This problem is simple, as long as can be sorted can be cat words.txt |tr-s "" \ n "sort | unique-c | Sort-r | awk ' {print $ ' $ '

Two methods of shell automatic Interactive processing of commands

1:use ECHO-E Example Echo-e "n\np\n1\n\n+100m\nn\np\n2\n\n+1024m\nw\n" |fdisk/dev/vdb \ n represents a carriage return [Email protected] ~]# fdisk-l/DEV/VDBdisk/dev/vdb:8589 MB, 8589934592 bytesHeads, Sectors/track, 16644 cylindersUnits = Cylinders

Read in the shell

Assigning values using read-in variablesParameters-P Setting prompt information-T set timeout timeHow to use:[Email protected] script]# read-p "pls input:" n pls input:12 [[email protected] script]# echo $n 12Special usage[email protected] script]#

Used Linux Shell Command before

--run. SH Job commandSh. sh--let Job run behind stageNohup ./.sh&--met error as below when rub. SH jobError ' XX.sh:line XX:sqlplus:command not found 'Method:source. Bash_profile--delete file,-f (delete directly without remaind)rm-f filename--delete

Shell EOF Attention Point

We use this when sqlplus interacts with the shell.Su-oracle-c "Sqlplus/as sysdbaSELECT * from GV ($instance);ExitEOF "This program does not seem to be a problem, the actual execution of the time will be error.Why?Because in this way, something in

Common judgments of shell scripts

-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 filename is writable,

Linux Shell Demo

#!/bin/sh for in. /* do if test-d $p then touch $p ". Ok" if test-f $p "/busi.xml" then echo "Delete ${p}/ Busi.xml " rm $p"/busi.xml " fi for Z in $ (Find $p-name" *.zip ") do

Shell various ways to perform the difference

Shell scripts are executed in various ways (source./*.sh,. The difference between./*.sh,./*.sh)Original source: http://blog.csdn.net/dance_rise/article/details/8573560Conclusion One: The/*.sh is executed in the same way as sh./*.sh or bash./*.sh,

Shell Script-relational array

  1 ################################## #######################################     2 # file name:  muscian.sh  3 # author: dty  4 # mail: [email protected ]  5 # created time: wed 05 aug 2015 04:41:14 pm  Cst  6 ######################################

Basic knowledge before learning shell scripts

Basic knowledge before learning shell scripts Chapter 2 LearningShellBasic knowledge before script In daily linux system management, shell scripts are indispensable. If you do not write shell scripts, you are not a qualified administrator. At

Linux shell reads the file line by line,

Linux shell reads the file line by line,Read File lines For Command replacement Code block redirection While Pipeline operator Code block redirection For IFS=$'\n'for line in `ls -l`do (( count++ ))doneecho $count Note:

Frequently used shell commands for updating Mac server services, and mac server shell commands

Frequently used shell commands for updating Mac server services, and mac server shell commands On the Mac server, you must enable remote logon. Enable: system preference settings-> share check remote LogonCommon Commands include: Copy (copy the

Total Pages: 541 1 .... 537 538 539 540 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.