Getting started with a simple SHELL under MAC

1. create file. sh fileIn this example, the full name of the sh file is demo.sh, and the next step is to use the freely familiar editor editor command to2. Write the. sh

Using the shell to determine the local area network users have those

#!/bin/bashwhile true; do  for i in {100..120};d o     ping -c 2 -w 2 192.168.0. $I  &>/dev/null    if [  $? -eq 0 ];then      echo -e  "\033[32;40m  192.168.0. $I  is up.\033[0m "    else      echo  -e  "\033[32;40m 192.168.0. $I  is down.\033[0m"  

Shell file Simple processing

Sometimes you need to simply deal with the file, with a few lines of shell script statements can be done, convenient, here to remember, while the next use. Combined with other people's blog and their own practice, but also the original

Shell--1, first shell script

Open a text editor (you can use the Vi/vim command to create a file), a new file test.sh, the extension sh (sh for Shell), the extension does not affect the execution of the script, see the name is good, if you write Shell script in PHP, the

Linux Execution Shell script

1. Create Shell script:/home/test.shcd/home/Vim tesh.sh #linux不区分后缀,. SH is only for user convenience;The first line of the test.sh file defines the format: #!/bin/bash indicates that the file is executed with the bash shell;Content to write

Linux Shell & placed behind the startup parameters to set this process as a background process

& placed after the startup parameter to set this process as a background processBy default, the process is the foreground process, then the shell is occupied, we can not do other operations, for those who do not interact with the process, many times,

Shell Script Rollup 2 delete files that have been created for more than 32 days

Shell Script Rollup 2 delete files that have been created for more than 32 days#!/bin/bash#date:2017-04-11#version:clear_ballcloud_back_v1.0#contents: removing the  /www /web/ballcloud_bakck/* , if the file is created above 32 day#cd

Shell scripts 6--loops, comparing

For loopfor var in list;Docommands, #使用变量 $varDoneExampleFor I in {A.. Z}; do actions; DoneLatterFor ((i=0;i{Commands}While conditionDoCommandsDoneUntil cycleExamplex=0;Until [$x-eq 9];DoLet x + +; echo $x;DoneIf comparison statementif

Shell pre-defined functions for Linux

$ $1-n The name of the current shell script the position variable $ #参数的数量 $* the value of all positional variables #? To determine whether the previous command succeeded, 0 for success, The non-0 is the failure---------------------------------------

Shell condition Test Statement if

Tag: Shell expression exists * * * Specify dir DIA statement return resultIf condition statement: The IF condition statement is divided into single branch structure, double branch structure, Multi-branch Structure-------------------------------------

Shell Application Tips

Shell Application TipsThe shell is a command interpreter, a layer of interaction between the kernel and the kernel. There are many kinds of shells, the one with the prompt that belongs to /bin/bash, and almost all Linux Systems default to this shell.

Shell under Action:command not found

Today to test a colleague wrote a shell script, execution of the error when the code is "Action:command not found"650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/97/EE/wKioL1k1HGHTyUhuAAAe51KKRyw564.png "style=" float : none; "title="

Querying the Shell's command--type

Type command[[Email protected] ~]# Type [-TPA] name options and parameters:: Step with any option no parameter, type will show if name is an external command or bash built-in command -T: Whenthe-t parameter is added, the type The name is displayed

Shell and regular Expression part1

1. What is a shell?The shell represents two levels of meaning, one is the command interpreter, such as BASH, and the other is a shell script (a program written using the shell's function, which uses plain text files to write some shell syntax and

Shell Programming 2

Shell Programming 2First, conditional judgment statement1, according to the file type to judge  Eg:test-e/etc/passwd or [-e/etc/passwd] &&echo yes | | echo no note [] There must be spaces on both sides2, according to the file permissions to

Shell Regular expression (1)

First, what is the regularA regular is a way to describe a character or string by combining symbols with special meanings, called regular expressions. Or, the regular is the rule used to describe a class of things.Second, grep1. Parameters-N: Show

Shell Regular Expression

One. grepgrep parameters:- n: Show Line Numbers- o: Show only matching content- Q: silent mode, no output, you have to use $? To determine the success of the execution, that is, there is no filtering to the desired content- L: If the match succeeds,

Shell scripting language Usage

Shell program run:1./xx.sh. Running the shell this way requires the shell program to have executable permissions. chmod a+x xx.sh to add executable permissions.2, Source xx.sh.3. Bash Xx.sh,bash is a script interpreter, which is essentially an

Shell script call jar package print multiplication table

#声明脚本#!/bin/bash#打印 "------CFB---------"echo "------CFB---------"#java环境变量Java_home=/usr/java/jdk1.8.0_11Classpath= $JAVA _home/bin#指定需要执行jar包的位置, you can set your ownJarpath=/home/haha/desktop#环境变量的标准格式Classpath= $CLASSPATH:

Shell--4, Shell array

Multiple values can be stored in an array. The Bash Shell supports only one-dimensional arrays (which do not support multidimensional arrays) and does not need to define the array size when initializing (similar to PHP).Like most programming

Total Pages: 541 1 .... 518 519 520 521 522 .... 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.