Parameters of shell scripts with conditional Selection

Simple shell scripts for tasks without variables are generally competent. However, when executing some decision-making tasks, it is necessary to include the IF/then condition judgment. Shell script programming supports such operations, including

Shell obtains the IP address of the local machine.

If you have multiple NICs, you must specify the NIC name because the IP address is related to the NIC. The method for getting the IP address of the specified Nic is:   Ifconfig eth0 | sed-n "p" | awk '{print substr ($ )}'   "Eth0" indicates the

Linux Automatic startup shell and init Overview

Linux running levelAfter Linux is started, it runs at one level. The following lists the running levels:0 system stopped1 single user system, no login required2 multi-user system, but does not support NFS, command line mode Login3 full multi-user

Common shell file processing commands

Merge and split files:1. SortCommand Format:Sort-CMU-O output_file [other options] + pos1 + pos2 input_file-C: whether the test file has been classified.-M combines two classification files.-U: delete all duplicate rows.-O stores the output file

Linux/Unix shell script to clear archived log files

For Dev and UAT environments, databases must be in archive mode, but do not need to be backed up. Therefore, the constant increase in archive archiving logs results in a large amount of disk space consumption. In this case, you can use a shell

Shift in shell programming

#! /Bin/shFiles = ""Trcase = ""EXT = ""Opt = No # Gets called when a conversion failsError_msg (){_ Filename = $1Echo "'basename $ 0': Error The Conversion failed on $ _ filename"} If [$ #-EQ 0]ThenEcho "for more info try 'basename $ 0' -- help"Exit

Shell Programming to Implement multiple attributes of a BACnet Device

#! /Bin/bash Prog = 'basename $0'Optional = 0 Usage (){Echo "Usage: $ prog [Options] [...]Will return required and optional property valuesFrom the requested device. -O display optional properties [default behavior]-O supress display of optional

Shell conditional expression

F statement format If conditionThenCommandElseCommandFi, don't forget the end. If statements forget the final fiTest. sh: line 14: syntax error: unexpected end of fi Three conditional expressions of if

Chown of shell commands

root@bt:~/test# chown --helpUsage: chown [OPTION]... [OWNER][:[GROUP]] FILE... or: chown [OPTION]... --reference=RFILE FILE...Change the owner and/or group of each FILE to OWNER and/or GROUP.With --reference, change the owner and group of each

Custom wince Shell

  ARM-based Windows CE kernel startup Analysis 1 1. startup. S2 2. kernelstart2 2.1 arminit () 3 2.1.1 oalintrinit3 2.1.2 oaltimerinit4 2.1.2.1 variable tick scheduler4 2.2 kernelinit () 4 2.3 firstschedule5 1. startup. s Kernel entry point:

Linux shell scripts that safely kill Tomcat Processes

Linux shell scripts that safely kill Tomcat processes, as many good script programming skills are used in this script, I would like to share with you; ## Firstly find the process of the tomcat ....Tomcat_process_str = 'ps aux | grep 'java. * Tomcat '

An instance that uses shell to implement automatic FTP

#! /Bin/bashEchoEcho "cintel FTP test tool"# Echo "Please input hostip: \ c"# Read hostip# Echo "Please input Username: \ c"# Read Username# Echo "Please input password: \ c"# Read PasswordRead hostip Username PasswordFTP-n Open $ hostipUser $

Shell (2) condition 2.16.doc

UsedIf/whileAnd so on;  Test Command Test Condition, When the condition isTrueReturns0; IfTest condition; thenIf[Condition]; then#Note the space,TBDSupported?If 0 ...... FiFi  Test Condition judgment, three types 1) Value

Differences between for and while in Shell

Find out the difference between for and while, and write out the memo. Script: File =/home/hadoop/phrases.txt for content in 'cat $ {file} 'Do phrase = 'echo $ {content}' echo $ phrasedone The phrases.txt file contains the following content:

Shell script Learning (III): Shell functions and some common symbols and commands

Shell script Learning (III): Shell functions and some common symbols and commands I. Shell functions Like C, Shell functions encapsulate commands and statements that have fixed functions and are usually used repeatedly in a single function, if you

Linux mobile phone DIY. Shell application extension 1. Random incoming ringtone (e680 Series)

Linux mobile phone DIY. Shell application extension 1. Random incoming ringtone (e680 Series) Papayas 2007-03-18 I. What is shell? Before getting started, I always used to copy some stuff from the Internet to "enrich" the content of the

Run shell scripts in Java

By using the runtime.exe cute method, we can run the Linux Shell script in a Java program or execute other programs. Referring to this article on the Internet: http://lee79.javaeye.com/blog/418549 (thanks), I rearranged the code.The

Shell brute-force single-step analysis (5) cracking tutorial

[Cracked by] layper[Author mailbox] layper2002@yahoo.com.cn[Author's homepage] www.sy135.com[Tools] peid, OD,[Cracking platform] Win9x/NT/2000/XP[Software name] single-step Analysis of Shell and shell chaos (5)[Statement of cracking] I am a cainiao.

Use shell scripts to automate your own micro-Linux! (2)

We have completed the first three steps. We will analyze the implementation of the entire shell script again: Implementation Process Analysis: 1. Partition: Format and partition the selected disk. 2. Attach the disks in user-defined partitions to

Example: Obtain the user name and password manually entered through the command line in BASH Shell

Sometimes in bash shell, we need to obtain user input information, such as user name and password. The password cannot be displayed... In the face of such requirements, the practical command read can be implemented. Read-P "input your Username:"

Total Pages: 541 1 .... 336 337 338 339 340 .... 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.