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
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
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 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
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
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
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
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,
[[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
#! /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:
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
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
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.
#!
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:
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
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
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