Connect to the remote server using ganymed SSH-2 for Java, and then execute the shell command;
First, we add a method to execute the shell command in the previous Commandrunner class, as shown in the following example:
public static string
one, parentheses, bracket ()
1. Single bracket ()① Command Group. The commands in parentheses will be executed in a new sub shell sequence, so the variables in parentheses cannot be used by the rest of the script. Multiple commands in
Login vs. Non-logon Shell:
Distinction: Whether you need to enter a username password.
Transformation:
Non-login can be converted to login using--login
Consider the conversion situation, the relatively scientific distinction: neither the password,
A brief introduction to shell script writing ideas and examples
Often heard around a lot of learning shell script Friends complain shell script is not easy to write, not difficult to write out the script has been an error, symbol space is too much,
in the previous section we learned about the Shell's echo command, which we'll learn from the Shell's other output command printf.
The printf command mimics the printf () program in the C library.
Standard, so scripting with printf is better than
In the previous section we learned about the Shell's echo command, which we'll learn from the Shell's other output command printf.The printf command mimics the printf () program in the C library.printf is defined by the POSIX standard, so scripting
First, Shell introductionThe shell is a program written in C that is a bridge for users to use Linux.The shell is both a command language and a programming language.A Shell is an application that provides an interface through which users access the
1, print the system load every 3 seconds#!/bin/bashwhiletruedo uptime sleep3 Done2, save the monitoring results to a file, execute in the background, and then monitor the file changes with Tail-fSH while. sh &[112867#!/bin/bashwhiletruedo
Installing expect[[email protected] ~]# yum install -y expectUse a script to log into a remote machineScripting 1.expectThe contents are as follows:[[email protected] expect]# vim 1.expect#!/usr/bin/expectset host "192.168.130.128" #定义变量set
Shell Special variables: Shell $0, $#, $*, [email protected], $?, $$ and command line arguments special variable list variable meaning $0the file name of the current script $n the arguments passed to the script or function. N is a number that
Before data transfer, SSH will encrypt the data that needs to be transferred, ensure the security of the session security, the SSH client also contains a remote copy SCP.1, the structure of SSHSSH service is composed of server Software (OPENSSH) and
Special symbols for Liunx
Represents a number of letters or numbers? Any one character"#" Comment\ de-Semantic characters| Pipe character
1.* represents any arbitrary character or number[[email protected]/]# ls *.txt1.txt[Email
Shell Input/Output redirectionMost UNIX system commands accept input from your terminal and send the resulting output back to?? to your terminal. A command usually reads the input from a place called the standard input, which, by default, happens to
Shell ScriptScript: Can execute the file, after running can implement some function (command stack, non-interactive)Standardize the general composition of shell scripts#! Environmental Statement (Sha-bang)# comment TextExecutable code#! /bin/bash
Logical Volume Label
Express meaning
1.
About the file and directory of the detection of Logical volume label!
-F
Common! Detect if "Archive" exists eg:if [-f filename]
-D
Common! Detects
(a) Title:(1) Create a folder(2) There are 10 files in the folder that begin with any letter or number(3) If the first digit in the beginning does not change(4) If the first letter at the beginning is changed to uppercaseFor example, the modified
When a variable is evaluated in a script, you need to add a [] to the outside and set a $[email protected] tmp]# cat real_mem_used01.sh#!/bin/bashTotal= ' Free-g|grep Mem |awk ' {print $} 'Used= ' Free-g|grep Mem |awk ' {print $} 'Buffer= '
Source: "Learn Linux with old boys" shell programming combatInterview Question 1: mass production of random character filenamesCode:[email protected]:/home/dell/shell# vim creat_ten_htmlfile.sh #!/bin/bash#date:
Shell programming-detailed introduction to sed commands, shellsed detailed introduction
Sed Introduction
Sed editor is called Stream editor. It is used to perform basic text conversion in an input stream (file or input from a pipeline. During
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.