Shell Script Case Analysis

#!/bin/sh### globalsimg_ext= "{png,jpg,gif}" sql_file= "My_images_mysql.sql" sql_ins= "INSERT INTO  images values  ("Sql_imageid_range=0sql_imagetype=1sql_name=" "sql_image=" "### ERRORNORMAL=0ERR_ Args=1err_no_dir=2err_no_file=3retval= $NORMAL #####

Linux notes: Shell basics and Bash's basic features

Shell's advantage: You can call Linux system commands directlyBasic syntax for shell scripts:Script name ends with. shThe first action of the program #!/bin/bash, tell the system this is a shell scriptWith # as a commentHow shell scripts are

Shell script programming string testing and looping

== : Two strings are equal! =: Two characters not equal> : Whether a string is greater than another string : Whether a string is less than another string- N String : Tests whether the specified string is empty- s string : Tests whether the

Shell Script Learning Note-----Shell variables

1, in the assignment statement Name=value can not have a space, for example: name = value of the form is considered to be three variables, because essentially, the content of the script is passed to the shell program variables, and the variables are

A simple shell.

Recently, follow the MIT operating system engineering Course (6.828/fall 2014) to write a simple operating system from scratch.Job 1 of the first lesson is to write a simple shell that can run the command and Support redirection (' > ', ' The source

GitHub's use (Git Shell)

I am not clever and understanding something are not quick. Even so,i can ' t be scared for facing it. Practice more and practice more. Don ' t stop your passion. Recently to work on GitHub with small partners to do projects, my github ....

Shell Multi-file Content Association match

Remove the first two columns from the a file and match the other file to print out the matching line from=$1compare=$2tofile=$3f1s= ($ (cat $from |awk-f ' \ t ' "{print $")) f2s= ($ (Cat $from |aw   K-f ' \ t ' {print $} ') #for i in ' seq 0 ${#f1s [

Shell Scripting Considerations

Set foot name as Test.shThe first line should be #! /bin/bash1, the operation and debugging results are not the sameDebug Sh-x test.sh when calculating two-digit and sum=$[$a + $b] to get sum=3+4 instead of 7Run to give script execution permission

The Shell Three Musketeers grep

Objective How did grep get out?It's going to take us discovering, "g/re/p" see, that's it. "Global Regular expression print" ==> "globally finds the regular expression (RE) and prints the resulting row. ”The grep family consists of commands

Shell command (ii) The art of Rsync

(1) rsync (remote synchronize) is a data synchronization tool that allows you to quickly sync files between multiple hosts via Lan/wan, or use rsync to synchronize different directories on your local hard drive. (2) Rsync is a tool for replacing

Shell Bash determines whether a file or folder exists

Shell Bash determines whether a file or folder exists1, #如果文件夹不存在, create Folders folder="Log"if[!-D"${folder}" ]; Then mkdir ${folder}fi2To determine if a file exists.="/var/www/log.txt"# -The f parameter determines whether the $file

Log cut Backup (test) shell script

#!/bin/bashcd= ' df-l |awk ' nr==3 {print $4} ' |awk ' BEGIN {fieldwidths= ' 2 1 "} ' {print '} 'If [$CD-ge 20];thenecho " hard disk space is full and cannot be backed up " | Mutt-s " backup alarm, please replace the hard drive in time " [Email

The difference between Shell script and different running modes

There are three main ways of running shell scripts in Linux:1. Direct command release: The shell.sh file must have readable and operational (RX) permissions, and then:Absolute path: Use/home/dmtsai/shell.sh to release commands;Relative path: If the

Linux Shell SSH Login Script

Linux Login Server Knock command too much, at some point it is inconvenient, so the shell wrote aI. Description Supports both secret and key formats The user name and password are both written and saved in clear text Two. Configuration

Reproduced Shell deletes scripts for various annotations

Transferred from: http://www.cppblog.com/zhangyq/archive/2010/10/08/127915.html1.txt content:File contentAabbccAbcdefgHilkdifdfdfMmmmmmmmEeeeeeeeeeeeeeComment Part 2>>>DdeeffSED-E ": Begin; />>/{/>>>/! { $! {N; b begin}; }; s/>>//; };" 1.txtFile

Shell Basics Exercises Explained

1037774765 cloning1. Create a user redhat with an ID number of 1001, a basic group like (Group ID 2002), and rent it near Linux.Groupadd-g 2002 LikeGroupadd LinuxUseradd-u 1001-g 2002-g Linux Redhat2. Create a user fedora with the note information

Shell Exercises Explained

Write a script that calculates all the odd and all the even numbers within 100 and displays them separately#! /bin/bashSum1=0For i in ' SEQ 1 2 100 'Dosum1=$[$sum 1+ $i]Doneecho $sum 1Sum2=0For j in ' SEQ 2 2 100 'Dosum2=$[$sum $j]DoneEcho $sum

Shell-Implemented Calculators

1 #!/bin/bash2 #FUNCTION Calculator3 #AUTHOR Wangbo4 #DATE 2015-09-26567 function Checknum ()8 {9 Expr + 0 &>/dev/null10Case $? Inch12 0)return $14;;15 *)16Read-t 50-p "Please input integer:" int18Check "$int"20Return "$int"2223;;Esac25}26function

Some simple instances of shell scripting

1. Word Frequency statisticsSed-e s/' [[:p UNCT:] '/'/g-e s/' [[:d igit:] '/'/g $filename | tr [A-z] [a-z] | Tr ' \ n ' | Tr ' \ n ' | Sed '/^$/d ' >>newfilename#干掉文本中的标点和数字#替换大小写#替换换行符为空格后再替换空格为换行符 (may not be necessary)#删除空行重定向到新文件Sort newfilename|

Shell Array related Operations

Reference: http://www.cnblogs.com/chengmo/archive/2010/09/30/1839632.htmlCreate an arrayA= (12345)Get array length${#a [@]} #${#变量} to get variable length ${#a [*]}Print array ContentsEcho ${a[@]} #echo $a print only the first element of the

Total Pages: 541 1 .... 375 376 377 378 379 .... 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.