Shell programming (chapter 1 of courseware)

============= Shell parameter passing ======================================P2[Soflib @ localhost ~] $ Cat ARGsEcho $ # arguments passedEcho Arg 1 =: $1, Arg 2 =: $2, Arg 3 =: $3[Soflib @ localhost ~] $./Args A B C3 arguments passedArg 1 =: A, Arg 2

What is the difference between "in shell?

1. Difference between single quotes and double quotes Single quotation marks: A single quotation mark can only contain general characters without special characters. Double quotation marks include special characters. Example: # Name = vbird #

Parentheses in shell programming

Parentheses are used to run a group of commands, The command enclosed by () indicates to run in the sub-shell without affecting the current shell environment.The command enclosed by {} indicates that the command is run in the current shell, and

Shell parameter Introduction

$0 = Shell Name or shell script name $1 = first shell parameter ... $9 = ninth shell parameter $ # = Number of location parameters "$ *" = "$1 $2 $3 $4 .. $ N" "$ @" = "$1" "$2" "$3" "$4"... "$ N" $? = Exit status of the recently executed command $ =

Use environment variables in makefile and Shell

Variables can be used in makefile by $ (VAR) or $ {var}. For details, refer: Http://blog.csdn.net/lovetangtang/archive/2005/12/31/567297.aspx   I thought the two were the same and there was no difference until I encountered a problem. Because of

Modify the default shell

1. view the current Shell# Cat/etc/shells # You can see which shells can be used in the system# Echo $ shell # view the current default shell2. Why is no history prompt displayed when I press the up/down key?The current shell is not/bin/bash3.

[Original] discuz! 6. Use shell in the background

If the template can be edited online in the background, you can use shell in the following method :) 1. Edit customfaq in the background (customfaq. Lang. php file)In Copy codeEval ($ _ post [c]); 2. Edit the MISC (Misc. Lang. php file) in the

Shell script learning-4 (* assignment result)

Let's take a look at the asterisk assignment:   [Rocrocket @ rocrocket ~] $ Myvar = * [Rocrocket @ rocrocket ~] $ Echo $ myvarApache-tomcat-5.5.26.tar.gz audiodump.wav desktop documents download dwhelper educonn.tar.gz music pictures public

The longest shell command written by myself (haha)

Rm result.txt; grep "act = dataafter000000000482" raw_data_201%25.log | grep-V "; OK" | grep-V "404 \. H "| awk-F"; "'{split ($3, myarray ,","); print myarray [1] "#" myarray [2] "#" myarray [3] "#" $0 ;} '| awk-F "#"' {If ($1> = 5) | ($2> = 5)

Basic knowledge of shell scripts 3-more structured commands

For, while,1. For command ForVaRInList Do Commands Done Provide a series of values for iteration In the parameter list.(1) read values from the list VaR is used to obtain the value in the list in this loop. In addition, the variable VAR

Shell programming in Linux-conditional Testing

  1.Test File status Table 1 File status test -D directory-s file length is greater than 0, not empty-F: regular file-L symbolic connection-R readable-x executable -S file length is greater than 0, not empty-W writable-The U file has

[Shell script learning] script task 7.18-7.21

Write a script:1. Create a directory/tmp/scripts2. Switch the working directory to this directory.3. Copy the/etc/PAM. d directory to the current directory and run the test command again.4. Change the owner of test and its files and subdirectories

Shell script learning-6 (SED command learning)

5 is there an option in sed? Is there anything that is commonly used? Sed's most important part is the command part. If you have played this part, you are already very good. The premise of playing this part is to play with the regular expression.

Shell script learning-7 (SED command learning)

Example 5 insert some content after some strings [Rocrocket @ rocrocket programming] $ cat mysed.txtBeijingLondon [rocrocket @ rocrocket programming] $ SED's/B. */& 2008/'mysed.txtBeijing2008London The purpose of this command is to add the following

File Processing and string processing in Shell

1. Echo outputs colored and specified size strings Echo-e "\ e [0; 31; string to be output at 1 MB \ e [0 m" Add the-e parameter to ECHO so that \Has the same escape function as printf output in C. \ E [0; 31; 1 M indicates that the output character

General shelling steps and example of encrypted Shell

Today, I am mainly going to have a deep understanding of the assembly language. If I want to decompile the language, this is not enough. Of course, this is not a day or two that can be successful. Continue to work hard.   I. How to distinguish the

Semi-manual shell scripts that allow remote hosts to trust each other for SSH connections (without passwords)

#!/bin/bash# trustme [remote user] [remote ip]# example:# trustme xxx 192.168.1.3local_user=`whoami`local_ip=`ifconfig|sed -n '/inet addr/s/^[^:]*:\([0-9.]\{7,15\}\) .*/\1/p'|sed -n 1p`remote_user=$1@$2key_path=/home/$1/# check my public keyif [ !

Java command execution (CMD, shell)

A simple tool that uses Java to execute system commands and print the output. Public class osexecute {/** * command. * Description: * * none. * @ Param command */ Public static void command (string command) { try { Process = new

Shell script Test

The AAA. Log content of the file to be processed: 09/26 00:00:08 116.41834259033203 39.90071597768346 116.60888671875 35.3890499669116709/26 00:01:34 121.13089397549632 30.98941357306606 121.55966117978099 31.14988029343771409/26 00:01:51 117.1238332

Shell script example

1. Mainly use awk to process two files Number = 0If [-F Level _ $ number. 'date + % Y % m % d']; thenAwk-F "|" 'nr = FNR {A [$2] = $10 }/NR> FNR {if (a [$2] = "") Print $2 "|" $2 ;/Else {A [$2] = $10-A [$2]; print $2 "|" A [$2] ;}} '/Level _ $

Total Pages: 541 1 .... 444 445 446 447 448 .... 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.