best shell scripting book

Want to know best shell scripting book? we have a huge selection of best shell scripting book information on alibabacloud.com

Bash Shell Scripting Learning (ii)

;NBSP;STATU=0NBsp;| |statu=1if[ "$statu" == "0" ];then echo $filename exists and is a directory. "rm -rf "$path/$filename" echo "deleted this directory! "else echo "$filename exists and is a file, deleting and creating a directory with the same name " rm-f "$path/$filename" mkdir "$path/$filename" echo "Creating now Please ..." echo "$filename Catalogue has been established! "fi ;; esacFor simple instructions, write the logic of the script. Use the TEST-E command to determine if the "log

Shell Scripting Learning Notes (advanced usage of SED----mode space and hold space)

original content). The final result is consistent with the results we see. 2. Transformation of Ranks Let me explain the above statement, h means that the content of the pattern space is appended to the hold space, ${...} means the last execution, which means that the contents of {} are executed last, so the contents of the space are consistent with the contents of cat in the last time,x Represents the content of the swap hold space and pattern space , then the contents of the patte

View all users under Linux (Shell scripting get)

In Linux systems, the two most important files for user account management are/etc/password and/etc/shadow.In the/etc/password file, each line represents an account, but there are many accounts that are system accounts. Like what:Bin, ADM, etc., as well as administrator account root. The rest is for general user accounts.Each line is composed of (to: Split):1 account name;2 password (combined with/etc/shadow);3 UID User ID, where 0 is the root, 1~499 is the system user account, and the general u

Shell scripting topics-----------fully automated compilation and installation of MySQL

/local/mysql/--datadir=/usr/local/mysql/data/--user=mysql ls/usr/ Local/mysql/data/ln-s/usr/local/mysql/bin/*/bin/service mysqld start echo "Now let ' s begin mysql_secure_installation "If [! -e/usr/bin/expect] then yum install expect-y fi echo ' #!/usr/bin/expect set timeout set password [lindex $argv 0 ] Spawn mysql_secure_installation Expect {"Enter for none" {send "\ r"; exp_continue} "y/n" {send "y\r"; Exp_continue} "Password" {send "$password \ r"; Exp_continue} "cleaning up" {send "\ r"}

Shell scripting basics, using variables, conditional testing and selection, and list-looping

Tags: $* operation definition test ifconfig dir rhel Zha preShell languageScript: Can run, a file, can implement some function (command stacking)[Email protected] ~]# vim/root/stu.shecho Hello WorldCat/etc/redhat-releaseUname-rHostnameIfconfig | Head-2[Email protected] ~]# chmod +x/root/stu.sh[Email protected] ~]#/root/stu.shCase 1: Writing a script to create a user[Email protected] ~]# vim/root/user.shUseradd nsd02Echo 123 | passwd--stdin nsd02[Email protected] ~]# chmod +x/root/user.sh[Email p

Shell Scripting Basics App (ii)

In order to make the shell script have a certain "judgment" ability, according to different conditions to accomplish different management tasks. Make the script a certain "smart".First, condition test operationFile Test Common operations:-D:: Test for Directory-E: Test whether the directory or file exists-F: Test for file-R: Tests whether the current user has permission to read-W: Tests whether the current user has permission to write-X: Test to set p

Shell scripting 30 minutes to get started

What is a shell script sampleLet's look at an example:#!/bin/shcd ~mkdir Shell_tutcd shell_tutfor (i=0; iExample explanation Line 1th: Specify the script interpreter, here is the interpreter with/bin/sh Line 2nd: Switch to the current user's home directory Line 3rd: Create a directory Shell_tut Line 4th: Switch to the Shell_tut directory Line 5th: Cycle conditions, 10 cycles Line 6th: Create a test_1 ... 10.txt file Li

"Shell script Programming Series" Knowledge reserves and scripting of building specifications

Tags: ges vim editor nginx root user Form bash script expec Ash rsyncObjectiveLearn about the knowledge reserves required for Shell script programming:Vi/vim Editor Command VIMRC set to be proficientBasic commands, more than 100 skilledBasic and common Network Service commands to be: NFS, rsync, INotify, Lanmp, Sersync, SSH keyI. Shell scripting concepts and exam

Linux Shell scripting language and mathematical expressions (1)

BKJIA Translation: It feels great when you understand Shell scripts and can write them smoothly whenever needed. In this chapter, we will teach you how to use scripting to perform complex mathematical operations. Let's start with the Fibonacci series. The Fibonacci series, also known as the Golden split series, refers to a series of 0, 1, 1, 2, 3, 5, 8, 13, 21 ......, Each of its items is the sum of the fir

Simple web-controlled shell scripting method

1) View PHP running users:System (' id-a ');?>General PHP running user is Apache2) do a key trust for Apache users:2.1)First look at the Apache user information:# Su-apacheThis account was currently not available.# Cat/etc/passwd|grep ApacheApache:x:48:48:apache:/var/www:/sbin/nologinSwitchApache:x:48:48:apache:/var/www:/bin/bash2.2)Root User action:Mkdir/var/www/.sshChown Apache. /var/www/.ssh2.3)Then switch to Apache User:Su-apacheSSH-KEYGEN-T RSA2.4)Root user, and finally change back to Nolog

Shell Scripting Bulk Ping IP

Recently do the computer room bandwidth detection. Recently wrote a shell script to ping the IP of the machine room in bulk, returning the failure rate and the average response time#!/bin/bashlog=$1.logecho-n "" > $logfor i in ' Cat $ do/bin/ping-s 1000-f-C $i > Ip.txtecho "' Curl ip.cn? ip= $i ' Cat Ip.txt |grep transmitted |Gawk ' {print $6} ' cat Ip.txt |grep avg | Gawk-f/' {print $} ' >> $logdonerm-rf ip.txtStore all IP required for detection in t

Shell Scripting Learning Summary 11--script debugging

Parameters:-N does not execute script, only checks syntax for errors-V Output the script contents to the screen and execute the script-X executes the script and outputs the content to the screen-N-VTen module () { eval '/usr/bin/modulecmd bash $*'}#/bin/bashif [$15 ];then "Yes"or "else" No " Fiyes-X[[Email protected] sbin]# SH-'['5']' 2operator expected+ echo NonoExpand:Use PS4 to make debugging output line numbers[[email protected] sbin]# echo $PS 4+[[email protected] sbin]# export P

Linux shell scripting Learn Xargs commands using detailed

]:~/learn$ cat Args.txt | Xargs SH cecho.sh;Arg1 arg2 arg3#Requirement 3, how do I embed parameters in a fixed command line? As shown below:Copy CodeThe code is as follows:[Email protected]:~/learn$ sh cecho.sh-p args1-1-P args1-1#[Email protected]:~/learn$ sh cecho.sh-p args2-1-P args2-1#[Email protected]sli-pc:~/learn$ sh cecho.sh-p args3-1-P args3-1#Solutions for using Xargs:Copy CodeThe code is as follows:[Email protected]:~/learn$ cat Args.txt | xargs-i {} sh cecho.sh-p {}-1-P arg1-1#-P arg

One of the Linux Shell Scripting Learning and combat

updated successfully.Changing password for user bruce03.Passwd:all authentication tokens updated successfully.Changing password for user bruce04.Passwd:all authentication tokens updated successfully.Changing password for user bruce05.Passwd:all authentication tokens updated successfully.Changing password for user bruce06.Passwd:all authentication tokens updated successfully.Changing password for user bruce07.Passwd:all authentication tokens updated successfully.Changing password for user bruce0

Shell Scripting-Example _ batch add user script

.passwd:all authentication tokens updated successfully.changing password forUser Username002.passwd:all authentication tokens updated successfully. changing password forUser Username003.passwd:all authentication tokens updated successfully. changing password forUser Username004.passwd:all authentication tokens updated successfully. changing password forUser Usernmae005.passwd:all authentication tokens updated successfully.The above script "can work", but not very perfect, then run one more, you

Some simple instances of shell scripting

"Print the system load info:"Uptime|awk ' begin{fs= ":"}{print $ |awk ' begin{fs= ","}{print "last 1 minute sys load:" $ "\nlast 5 minutes sys load" $ "\nl AST 15minutues sysload: "$" \ n "}"}Mem_info () {Echoecho "Print the system memory and swap info:"Free-h |grep Mem|awk ' begin{fs= ""}{print "System free Memory Info:" $4 ""} 'Free-h |grep Swap|awk ' begin{fs= ""}{print "system Swap Info:" $4 ""} '}Disk_info () {Echoecho "Print the system disk info:"Df-hEcho}MAIN () {Clearecho "=============

Shell Scripting Exercises

Write a small script to calculate how many days you have for your birthday.#!/bin/bash# Enter your birthday date, calculate how many days you have birthday #2015 July 20 read-p "Please enter your birthday date (YYYYMMDD):" date1date_d=$ (echo $date 1|grep ' [0-9]\{8\} ') if[ "$date _d" == "];thenecho" You typed the wrong format ... "exit1fideclare-idate_bir=" date --date= "$date 1" +%s ' declare-idate_now= ' date+%s ' declare-idate_left=$ (( $date _bir-$date _now)) declare-idate_d=$ (($date _l

Shell Scripting Exercises

for the second partition;(3) for Rootfs to provide bash, LS, cat programs and the library files that depend on;(4) Provide the configuration file for grub;(5) The new hard disk is set as the first boot item and can start the target host normally;8. Write a script(1) can accept four parameters: Start, stop, restart, statusStart: Output "starting script name finished."...(2) Any other parameters, all error exits;9, write a script to determine whether a given user is logged into the current system

Shell Scripting Exercises

1. List the directory under the current directory (only one level is required)1 #!/bin/bash 2 for f in ' LS ' 3 do 4 if [-D $f] 5 then 6 echo $f 7 fi 8 done2, the current directory of files (only need a level) listed1 #!/bin/bash 2 for f in ' LS ' 3 do 4 if [-F $f] 5 then 6 echo $f 7 fi 8 done[[Email protected] ~]# date +%f "%T" 2016-02-17 15:54:13Knowledge points : In a shell script, if also often judge about the file attributes, such as whether it i

Some easy-to-confuse concepts about shell scripting

???Because in IO redirection, the standard output is prepared before it is read from the standard input to the standard output. is not a bit around.It's like passing the baton in a relay race; you don't see the guy with the stick, you're definitely not going to send the baton out.So, in the cat 3. How variables are evaluated in a for loopA. Taking values from a set of stringsFor Var in one, three four fiveDoEcho ****************************Echo ' $var is ' $varDoneB. Taking a value from a positi

Total Pages: 15 1 .... 11 12 13 14 15 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.