Shell Script Learning 12 shell string

Strings are the most common and useful data types in shell programming (except numbers and strings, and no other type works well), strings can be in single quotes or double quotes, or without quotes. The difference between single and double quotes

Shell Intranet Host Survival detector

Recently in the study of shell programming, idle to do nothing, to engage in a small shell. can be used to detect the surviving host of a network segment.1#!/bin/Bash2 #3#Date: the/ A/ -4#blog: www.cnblogs.com/Outline5 #by: Joe6 7 if[$#-lt1] ; Then8

On the first day of the shell, add a normal account.

System Environment centos6.5[Email protected] wang]# uname-r2.6.32-431.el6.i686Official Add Account:[Email protected]/]# Useradd Wang #添加用户wang[[email protected]/]# tail-l/etc/passwd #用tail命令查看passwd文件,-l Display countdown 10 lines[Email protected]/]

Get External variable contents in shell while

First, the questionThe question is simple, look at the following section of tmp.sh code:#!/bin/Shx= "This was theinitial value of x" while a read line; Do x= "$line" = $x/tmp/tmp's Content1,aExecute./tmp.sh, the normal x variable is

X Shell 4 color scheme [solarized Dark]

X Shell 4 is a good terminal to log into Linux server under Windows, which is more useful than puttyX Shell 4 Below this scenario, I personally likeThe effect of writing shell scripts with vim:Follow these steps to configure:1) Save the following

Operating shortcut keys under the shell

Use the shortcut keys to reduce the number of mouse clicks, thereby improving efficiency, below is the summary of the Shell shortcut keys:CTRL + A cursor goes to the beginningCtrl+e cursor goes to end of lineCTRL+F cursor moves one character to the

Shell Programming Basics while practicing

First, the grammar while [Condition] # when the condition condition is established, loop until the condition is not set to stop doing #执行内容done Second, practice Enter the user input parameters until the user enters "end" to end the loop

Write your own shell command du

The du command can view the number of tiles occupied by the specified folder, and the following is the code for the C language implementation of the Shell du Directive under Linux (Support-k option):#include #include #include #include #include

Linux Shell Script LDD command principle and use method

1, first LDD is not an executable program, but just a shell script2, LDD can display the dependency of the executable module, the principle is by setting a series of environment variablesAs follows: Ld_trace_loaded_objects, Ld_warn, Ld_bind_now,

Java Execution Shell command

Package com.pms.util;Import Java.io.File;Import java.io.IOException;Import Java.io.InputStream;Import java.util.ArrayList;Import java.util.List;Import Org.apache.commons.logging.Log;Import Org.apache.commons.logging.LogFactory;/*** Execute Linux

Shift usage in Shell

[[Email protected] shell] # Cat shift. Sh #! /Bin/bash Until [$ #-EQ 0]; do Echo "the first is: $1 total is $ #" Shift Done [[Email protected] shell] #./shift. Sh 1 2 3 4 5 6 The first is: 1 total is 6 The first is: 2 total is 5 The first

Use of IF Statements in Shell

#! /Bin/sh # Determine whether to use a positive or negative number based on the entered number. Path =/bin:/sbin:/usr/bin/:/usr/sbin:/usr/local/bin:/usr/local/sbin :~ /Bin Export path Echo "Enter the number \ n" Read shuzi If [$ shuzi-GE 0];

Method for obtaining the process ID by shell: pidof | pgrep | PS-A + grep + awk

Method for obtaining the process ID by shell: I know there are three things I have learned and practiced: PS-A | grep "cmdname" | awk '{print $1 }' Pidof "parameter name" Pgrep "cmdname" The three running results in bash and busybox ash

Zabbix automatically installs server (Shell)

#!/bin/bashDBUSER=‘root‘DBPASS=‘‘DBHOST=‘localhost‘ZBX_VER=‘2.0.1‘function checkReturn {  if [ $1 -ne 0 ]; then     echo "fail: $2"     echo "$3"     exit  else     echo "pass: $2"  fi  sleep 3}cat  /dev/null  /tmp/mytmp393; mv /tmp/mytmp393 /etc/zab

Shell-z-D and so on

1234567891011121314151617181920212223242526272829303132 [ -a FILE ] IfFILE If yes, it is true.[ -b FILE ] IfFILE If the object exists and is a special file, it is true.[ -c FILE ] IfFILE If a special file exists and is a word, it is

Shell script ----- Function

Tag: Please user null Syntax format Function Name (){ Function body } Function Name -------------------------- Function body can contain command loop judgment Example: Determine whether a user exists. The output user ID and shell exist. #!

Restart Tomcat using shell Array

#! /Bin/bashExport AT1 = "/usr/local/export AT1 /"Tomcat2 = "/usr/local/tomcat2 /"Tomcat3 = "/usr/local/tomcat3 /"Tomcat4 = "/usr/local/tomcat4 /"Tomcat = ($ tomcat1 $ tomcat2 $ tomcat3 $ tomcat4)# For (I = 0; I # $ {Tomcat [$ I]} bin/shutdown.

Efficiency in Shell

I recently wrote a shell script, which has high efficiency requirements, so I read some articles. I feel that this article is really good. The example in this article is really great! Institute Use me to extract them: @ 1: instance: Requirement:

Shell-traverse directories and Perform Batch operations

Requirement: traverse all APK installation packages and install them in batches. Idea: there should be many ways to implement it, but I am not familiar with shell commands. I chose the simplest one. The find command should be simpler and updated

Linux Command -- bash shell configuration, linuxbash

Linux Command -- bash shell configuration, linuxbash I. shell Type From the perspective of user login, shell types include: 1. logon shell: (read environment configuration) Normally log on through a terminal: Su-USERNAME Su-l USERNAME 2. Non-Logon

Total Pages: 541 1 .... 358 359 360 361 362 .... 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.