linux shell scripting cookbook

Alibabacloud.com offers a wide variety of articles about linux shell scripting cookbook, easily find your linux shell scripting cookbook information here online.

The SED of Shell scripting learning

file from line 22nd to line 33rd to the end of line 44th. Sed ' 1,21h;22h;23,33h;44g ' pass 18, move the file from line 22nd to line 33rd to the end of line 44th. Sed ' 22{h;d};23,33{h;d};44g ' pass 19, only the first word of each line is displayed. Sed-nr ' s/([^a-z]*) ([a-z]+) ([^a-z]+] (. *)/\2/p '/etc/passwd 20, print the first word and the third word of each line. Sed-nr ' s/([^a-z]*) ([a-z]+] ([^a-z]+) ([a-z]+] ([^a-z]+) ([a-z]+] (. *)/\2

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

##################################################################################################Shell script:Scripts: Files that can be executed, implemented after running a certain function (command stacking, interactive)Standardize the general composition of shell scripts:#! Environmental statement# comment TextExecutable code##############################################################################

The basics before you learn shell scripting

Tags: string operation dos identifier related roo type replace Tor detail" What is Shell "Simple understanding, is the system with the computer hardware to use intermediate media, it is only a tool of the system. In fact, there is a layer of stuff between the shell and the computer hardware that is the system kernel. For example, if computer hardware is compared to a person's body, and the system kernel is

Shell Scripting Basics App (ii)

LinuxPartition 1 does not end on cylinder boundary./dev/sda2 13055 104344576 8e Linux LVM2, dual-branch If statement application, statement structureFor the two-branch selection structure, for the "condition", "condition is not established", both cases to perform different operations1) For example: Write a connectivity test script pinghost.sh,[Email protected] ~]# vim pinghost.sh#!/bin/bashPing-c 3-i 0.2-w 3 $ >/dev/null/Check to see if the target ho

To partition a hard disk using Shell scripting Automation

, This command keeps the command that is about to jump to another shell terminal to continue running in this terminal.The end of the logo is EOFThe two empty lines in the middle represent the carriage return, the default meaning.1 umount/dev/mmcblk1p1 2 /dev/ mmcblk1p13 umount/ dev/mmcblk1p2

Shell Scripting-Example _ batch add user script

User management is one of the tasks of Linux system maintenance, in which simple actions such as adding and deleting users are designed.Requirements: Add a lot of users at once. In a text file.Format: In the unit of behavior, each line is a user information. The user name and password are separated by a specific delimiter, but are spaces, commas, tab keys, and so on. Here is a space to distinguisheg[email protected] ~]$ cat addusers.txt username001 pa

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

Shell Programming service scripting, file lock, and signal capture

Shell scripting is an essential skill for Linux OPS engineers and a very important skill, so it's only good to learn shell programming well. Basic grammar I will not speak, learn the C language of these languages, a little bit to understand the basis of shell programming, so

Shell Scripting Raiders (Reading notes)--1.11 command substitution and the role of child shells

environmental changes to the parent shell. 2. Use parentheses () Running a command in () also opens a child shell. So do not randomly write () in Linux to change the priority, unless it is escaped, and the parentheses after the turn to have a space between the contents of the parentheses. [Email protected] tmp]# echo $BASH _subshell 0 [Email protected] tmp]# (ec

Getting Started with Shell scripting basics

only numbers, letters, or underscores, and cannot start with a number3, as far as possible to see the name of the ideaVI. Bash configuration files1. Profileclass : Provides configuration for the interactive login shell process.• Valid profiles for all users are globally valid:/etc/profile and/etc/profile.d/*.sh• Only the profile that is valid for the current user is valid for the user: ~/bash_profileNote: The function of profile type configuration fi

Shell Scripting Learning

What is a shell script?A shell script is a text file that contains one or more commands.As a system administrator, we often need to use multiple commands to accomplish a task, and we can add these commands in a text file (shell script) to accomplish these everyday tasks.What is the default login shell and how to change

Shell Scripting Learning (iv)

redirect to generate a patch file:[Email protected]:~/dl$ diff-u version1.txt version2.txt > Version.patch[Email protected]:~/dl$ cat Version.patch---version1.txt 2015-12-28 19:16:28.866869790 +0800+ + + version2.txt 2015-12-28 19:17:12.078872041 +0800@@ -1,5 +1,5 @@This is the original text-line2-line3+lin2Line4Happy hacking!+gnu is not UNIXUse the following command to Patch:[Email protected]:~/dl$ patch-p1 Version1.txt Patching file Version1.txt[Email protected]:~/dl$ cat Version1.txtThis is

Copy the daily EXPDP export file of an Oracle database to a remote server using shell scripting

Copy the daily EXPDP export file of an Oracle database to a remote server using shell scriptingZhao Full Text Network name: GuestartWe have a production environment Oracle database, although the daily Rman backup, but also overwhelmed by the developer go out said to restore a few days before the table data into the production environment, in response to such requirements, using Rman to recover a few tables of data is particularly laborious. So I decid

Using Go as the scripting language in Linux

space but since we think Shebang is not the best choice for Go scripting, it seems that we need something else. Surprisingly, the Linux kernel already has a "other type of" binary support module, which has an appropriate name of ' Binfmt_misc'. This module allows the administrator to dynamically add support for various executable formats from the user space directly through a well-defined ' PROCFS ' interf

Shell scripting-handling input and output

, and the read command will automatically exit after reading the corresponding character without a carriage return. (3) Hidden mode read needs to read user input, but do not want the input displayed on the screen, you can use the-s option.5 " "passwdIi. input and output redirection (1) standard file descriptor The Linux system treats each object as a file, using a file descriptor to identify each file object. The file descriptor is a non-negative num

Configuration and optimization practices for the Shell Scripting development environment

information such as interpreter and author at the beginning of shell scriptAutocmd bufnewfile *.py,*.cc,*.SH, *.java exec": Call Settitle ()"func settitle ()ifExpand"%:e") =='SH'Call Setline (1,"#!/bin/bash") Call Setline (2,"#Author: Yang Yuanqiang") Call Setline (3,"#Blog1: http://aqiang.blog.51cto.com") Call Setline (4,"#Blog2: http://www.cnblogs.com/ivan-yang/") Call Setline (5,"#Time:". Strftime ("%F%T")) Call Setline (6,"#Name:". Expand ("%"))

The internal variables of shell scripting learning

Tags: Ignore program linu a share picture strong edit contains technology sharingOne$BASH    The path of the Bash 's binary program file  Two$BASH_ENVThis environment variable will point to a bash startup file that will be read when a script is called.Three$BASH_SUBSHELLThis variable is used to indicate the level of the child shell四, $BASH_VERSINFO[n]This is an array of 6 elements that contains the version information of the bash that was installed# B

Shell Scripting Learning Notes (normal form)

Fgrep. These return values make it possible to perform aself-initiated text processing. I used the Egrep tool in the example above. is the extension of grep, a lot of other ways to use this tool and the above introductionSome of the inadequate places you can go to the encyclopedia to find out, in fact, some of the more advanced tools also support this expression. I'll be in the knot.The blog is again introduced.I personally think that the rote of these characters is inappropriate. We should le

Shell Scripting Learning notes-integer Two-dimensional comparison operator

Tags: Linux shell1.1 The following table is a common two-dimensional comparison operatorWe can also see through the man testTips(1) The "(2) the ">" symbol is greater than the meaning, if[["$a" > "$b"]], if[["$a" \> "$b"]. You need to escape in parentheses because the shell is also redirected with (3) The "=" symbol equals the meaning, if[["$a" = "$b"]],if[["$a" = "$b"]. Escaping is not required in single [

Shell Scripting Learning

=file:/dev/./urandom- Xmx512m-verbose:gc-xx:+printgcdetails-xx:+printgcdatestamps-xx:+heapdumponoutofmemoryerror-xloggc:gc.log"nohup Java$DEBUG-jar$OPTS ${jar_file}>$APP _home/${log_file}2>1 PID=$!Echo$PID>${app_pid}if[ !- F $APP _home/App.log]; Then Echo"begin ... ..">>$APP _home/App.logfiIf judgment parameter[-a file] True if file exists [-B file] True if file exists and is a block special file [-C File] True if file exists and is a word special file [-(d file] True if file is present and is a

Total Pages: 15 1 .... 6 7 8 9 10 .... 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.