Create two scripts in the system bin directory, respectively, Pssh tsshPssh#!/usr/bin/expect-fSet IP [lindex$argv 0]set Port [lindex$argv 1]set Password [lindex$argv 2]set TimeoutTenspawn ssh [email protected]$ip-P$portExpect {"*yes/no"{Send "yes\r";
Using Qprocess Qthread============================================#include int main (){Qprocess::execute ("LS");return 0;}============================================
Qprocess *poc = new Qprocess;poc-> Start ("Ping 222.207
First, Shell special variables1. Position Variables
Positional variables
Meaning
$
Gets the file name of the currently executing shell script, including the script path
$n
Gets the nth
Overview:Statement control for Shell scripts-There are three processes in the process programming language mentioned earlier:Sequential execution: Executed in the order of a single statement;Select execution: Select execution according to the
Exercise one: Write a script 1. Set the value of the variable file to/etc/passwd 2. Say hello to each user in/etc/passwd, and say what the ID is like: (Hint: line= ' wc-l/etc/passwd | Cut-d ""-f1 ') Hello,root,your UID is 0. 3. Count the
The file name of the shell itself
$1~ $n Each parameter value added to the shell. $ $ is the 1th parameter, and the $ = is the 2nd parameter ...
$$ the shell itself PID (ProcessID)
$! PID of the Shell's last running background process
$?
What I'm sharing for you is how to use case statements to write some scripts that you choose to execute. Case statements are mainly adapted for use in some complex selection of scripts, if we use if multi-branch statements can also be written out,
One, bash variables:Variable naming laws:1. The reserved words in the program cannot be made: for example if, for;2, only use numbers, letters and underscores, and cannot start with a number3. See the meaning of the name4, the Uniform naming rule:
Types of variables in bash1. Local variable: The active scope is the current shell process and is not valid for Shell processes other than the current shell, including the current Shell's child shell processVariable assignment: name= ' value 'Use
How to let awk use Shell variables under LinuxWhen we write shell scripts, we typically include other small programs or commands in the script, such as awk operations. For awk , we need to find some way to pass some values from the shell to the
First, the concept and characteristics of regular expressions:A regular expression is a logical formula for a string operation, which is to make a "rule string" with a predefined set of characters and a combination of those specific characters.This "
ObjectiveWhat the hell is a shell? Before this, we should understand the issue of file permissionsBody
Shell versionVarious versions:
Bourne Shell (SH), C Shell (CSH), and Korn Shell (Ksh)And at present:The common and CentOS default
GrepIn the past, we used grep to find lines in a file that contained certain strings, such as finding a string in a header file that fits a pattern (pattern), such as finding all strings that conform to the [email protected] pattern (that is, the
Let, (()) and [] perform basic operations in bash, and advanced operations will use expr and BCLet# Let Result=x+ySelf-adding operation# Let X + +Self-decrement operation# Let x--Shorthand form# Let X+=6---Let x=x+6#let x-=6--Let x=x-6[]# y=$[2 + 1]#
the difference between the ' and $ ' ():In Bash, $ () and "(anti-quote) are used for command substitution.Command substitution is similar to variable substitution, which is used to reorganize the command line, complete the command line in quotation
IP independent IP in the specified time of the non-pass IPSquid Statistics method[Email protected] etc]# cut-d ""-f1/usr/local/squid/var/logs/access.log|sort|uniq|wc-l2823When you use awkawk ' {print '} ' |sort|uniq
Set Environment variables:①export variable name = variable Value #设置环境变量② variable name = variable Value #设置环境变量Export variable NameSet #显示当前shell所有变量Env #查看环境变量unset variable name #删除变量Common environment variables:Path variable: Paths to System
1. After installing Spark, enter spark in the bin directory: Bin/spark-shell scala> val textfile = Sc.textfile ("/users/admin/spark/ Spark-1.6.1-bin-hadoop2.6/readme.md ") scala> Textfile.flatmap (_.split (" ")). Filter (!_.isempty). Map ((_,1)).
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.