Example 1.The new test.sh content under/home/admin/test/is as follows:CD 'dirname $0echo 'pwd'Then return to/home/admin/to executesh test/test. SHOperation Result:/home/admin/testThis allows you to know the location of the files deployed with the
This article mainly introduces the shell script 8 kinds of String interception method summary, each method gives the example code and operation results, at a glance, the need for friends can refer to the nextString interception of Linux is useful.
Words do not say much, straight to the subject, LZ is not bad at writing an article, just record their own learning process in a bit drops.Note: The shell is sensitive to case letters. Open terminal appears: [email protected]$ Span style=
The main contents of this section:Top command to count CPU utilizationOne, problem analysisMySQL is multi-threaded under Linux and can only distribute multiple threads to a single CPU.Therefore, using a small server, or PC server, multiple CPU
1. Command-line arguments1.1 Parameters space-delimited, format: $+position, e.g. $, $, $, where $ $ represents the script name, more than 10 parameters, e.g. the 10th parameter is represented by ${10};1.2 Simple example:1.3 Through the
#!/bin/bash # # ip_check This shell script takes care of checking all IPAddress. # # Create by Xuekun # date 2015-12-6 # Beijing Open Source # source function library. ./etc/rc.d/init.d/functions App_path= ' pwd ' Log_path=${app_path}/ip_
1, in three ways to achieve delete the last line of the file.[[email protected] sjx]# cat 123123[[email protected] sjx]# sed ' $d ' 12312[[email protected] sjx]# cat 123 |head-$[$ (cat 123|WC-L) -1]12[[email protected] sjx]# cat 123 |sed-n ' $!p ' 12
1. Piping "|"ls | Cat-n > OUT.txt2. Child shell2.1 Child Shell DescriptionYou can use the () operator to define a child shell in a shell script#/bin// ; ls) pwdExecution results Description: Does not have any effect on the current shell when the
Learning Shell The script experience
Shell script Run Environment:Shell script, is to put multiple commands, organized into a file, to implement a series of actions, convenient execution of a file.
Shell scripts are primarily used in
In some scenarios where security requirements are high. SSH timeout is pre-set by the administrator, after idle for a period of time SSH connection will be actively disconnected.This scenario assumes that the script runs through SSH and the script
1. Basic Shell Syntax: (Hello,shell)#!/bin/bashecho"Hello,shell! "The results of the operation are conceivable: Console output:Hello,shell2.Shell variable definitions and references:#!/bin/Bashvalue="hello,shell"echo $valueRunning Result:
1.shell of learning.There are three types of shells:/bin/sh,/bin/csh,/bin/ksh.See what kind of shell is currently in use: Command env (displays the environment variables for the current operating system).Change the shell type: chsh-s/bin/cshShell
/******************************************************************************* * Linux Shell Ls-1 Column Display file * Description: * Sometimes when writing shell scripts, it is often necessary to list the files in a column, and then the * for
Today, let's introduce some common shell commands in the Mac Terminal:1. View the full path to the current working directoryPwd(PWD's original intention is: Print work directiory, not password password meaning, hehe)2. View the command's detailed
The special characters are as follows: "#"--Comment, beginning with # at the beginning of the line (#! is an exception).“;” --the command delimiter, which can be used to write multiple commands on a single line.“;;” --Terminates the "case" option.“.”
FileZilla Unable to determine the target of the drag-and-drop operation because the shell is not properly installed __ workaroundAfter reloading the system and related software, using FileZilla to drag and drop files on the FTP file to the desktop,
Suppose there is a variable var=http://www.google.com/test.htmA # Intercept, delete the left character, and leave the right character.Echo ${var#*//}where Var is the variable name and the # is an operator, *//indicates that the first//number and all
Definition of the array:Array name = (element 1 element 2 element N) # A pair of parentheses indicates an array, and the elements of the array are separated by a "space" symbol.Example: myarray= (1 3 5 7 9) # Note the method defined, parentheses,
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