Linux Shell Special variables

$: script name, which is the script name entered by the command line$n: Positional parameters, n>0, when n>9, using ${n} form$#: Number of positional parameters"$*": All Positional parameters (single string)[Email protected]: All positional

The ANSI control of the bash shell

Format: echo-e "\033[word background color; font Color m string \033[0m"For example:Echo-e "\033[41;36m something here \033[0m"Where 41 of the position represents the background, 36 of the position is the color of the wordThose ASCII code is the

Lao Li share: "Linux shell Script Raiders" essentials (eight)

1. Printing process [[email protected] program_test]# PS-E | HeadPID TTY Time CMD1? 00:00:03 Init2? 00:00:00 Kthreadd5 y 00:00:00 migration/06} 00:00:00 ksoftirqd/03 y 00:00:00 migration/04} 00:00:00 watchdog/07? 00:00:00 events/08? 00:00:00 Cgroup9?

Shell conditions and loops

A If statementif [expression]ThenElif[expression]ThenElseFiNote: There should be a space before and after expression;Then you can start another line, or you can go with the if peers, to add '; ' ;Two Case modeCase Value inMode

Shell Programming Learning

1.Shell programming As with Java, PHP programming, as long as there is a code to write a text editor and a can explain the execution of the script interpreter can be#!/bin/sh (#! tells the system that the program specified after the path is the

Shell performs FTP action and log merge

First, FTP download the current file according to the date#!/bin/bashdate= ' Date +%y%m%d ' ftp-n Second, upload the current file according to the log#!/bin/bashdate= ' Date +%y%m%d ' ftp-n Three, more and catalog upload download#!/bin/bashdate= '

Note-shell Special variables

Positional variables:$: Gets the file name of the current execution shell, including the script path if the script is executed with a path $n: Gets the n=1..9 parameter value of the currently executing shell script, which represents the file

Getting Started with Shell programming

1.5 Cut command--split fileCut-d:-F 3/ETC/PASSWD take 3rd paragraph1.6 Sort Command--sortSORT-T:-k3/etc/passwd sorted by 3rd paragraph-N Sort by number-R Reverse Order-U Remove Duplicate entries1.7 WC Command-L Calculation of rows-W Computed

Shell Script Implementation command line multilevel menu (no specific function)

#!/bin/bash#auth chentp0601#date 20151123Function menu (){ClearCat #this is Base menu1.[install Lamp]2.[install LNMP]3.[exit]EofRead-p "Please input 1-3:" ListCase $list in"1")While TrueDoMenu_lampDone;;"2")While TrueDoMenu_lnmpDone;;"3")Echo-e

Linux shell variables get execution results

Linux shell variables get execution resultsThe method of assigning the result of a command to a variable is:1, use the anti-quotation mark "(number key 1 left key, TAB key above, English way input)such as: A= ' echo ' Hello World ';Assigning the

The shell connects two scripts.

Tag: The shell connects two scripts.#!/bin/bash##This is for auto run the script to save the time##By [email protected]#chose the latest file and chose one to runarray[0]= ' Ls-lt/mnt/shfw/builds/griffin/experimental | awk ' {print $9} ' | Sed-n '

Linux Shell Learning notes-compare operations

integer comparison-eq equals, as:if["$a"-eq"$b" ]-ne not equal to, such as:if["$a"-ne"$b" ]-GT greater than, as:if["$a"-gt"$b" ]-ge is greater than or equal to, such as:if["$a"-ge"$b" ]-lt less than, such as:if["$a"-lt"$b" ]-le less than equals,

Shell Statistics Log Information

Shell Statistics Log InformationIn general applications, log information is logged using log4j and a log file is generated daily, with each file ending on the date of the day.How do I count and analyze these log messages?In the simplest cases, use

Shell Primer-awk-2

The conditional operator of awkShows the first line with root[[email protected] ~]# awk-f ': ' $1== ' root ' 1.txtRoot:x:0:0:root:/root:/bin/bashShow first line with root print first paragraph[[email protected] ~]# awk-f ': ' $1== ' root ' {print '}

Shell menu (Springboard Management and connection scripts)

#!/bin/bashWap_server= "10.0.0.1"Mem_server= "10.0.0.2"Erp01_server= "10.0.0.3"Erp02_server= "10.0.0.4"Erpold_server= "10.0.0.5"Backup_server= "10.0.0.6"Monitor_server= "10.0.0.7"Dossh=/home/lichuang/scrips/dossh.sh

Several parameters of the shell script

The execution name of this program$n the nth parameter value of this program, n=1..9$* all parameters of this program, this option can have more than 9 parameters.$# the number of parameters for this program$$ the PID of this program (the current

Corrupted Linux/home folder, using Shell to quickly recreate

Problem Description:LAN built Hadoop Environment, node/home is mounted on a separate disk, a power outage causes several node/home file system corruption, unable to recover, only after formatting and re-mount home/home, and then use the script to

Shell Getting Started-cut command

Command: CutOption:-d:-f Specifies the segment divided by ": (separator)" In the first paragraph-c Specifies the number of charactersDescription: Select the command, select a piece of data we want, generally for each row to analyze the

Conditional expressions in the shell

The result returned by the conditional expression is BooleanIt's 1, false is 0.Expressions for conditional tests[Expression][[Expression]]Test expressionCommonly used for:Monocular:-e file Test files exist-F file Test is a normal file-D File Test

Shell Line Script

Each time on-line, first put the intranet code with Xhell to local. Then drag it to the online server.Dragged and dragged, too slow. So I wrote an online script.Wrote a few versions, this is the final versionscp_v3.shThe contents are as

Total Pages: 541 1 .... 477 478 479 480 481 .... 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.