Shell combined with expect for automatic password entry

Shell combined with expect auto-input Password example1#!/bin/Bash2 3cd/data/Live4 5/usr/bin/expect EOF6Spawn git clone"ssh://xxxxxxxxxxxx"7Expect"*passphrase*"8Send"passwordhere\n"9 expect EOFTen EOF One A Time= '/bin/Date "+%y%m%d%h%m%s"` -CD

Shell Bulk Add Users

#!/bin/bashRead-t 30-p "Please input user name:" NameRead-t 30-p "Please input user number:" numRead-s-T 30-p "Please input user password:" PassEcho-e "\ n"if [!-Z "$name"-A!-Z "$num"-A!-Z "$pass"]ThenY=$ (echo "$num" | sed-e ' s#^[0-9]# #g; s#[0-9]*

Linux shell directives such as-D,-F,-E, and other judgment expressions

File comparison Operators-e filename true if filename exists [-e/var/log/syslog]-D filename True if filename is a directory [-d/tmp/mydir]-F filename True if filename is a regular file [-f/usr/bin/grep]-L filename True if filename is a symbolic link

A shell that gets memory information and a pit that it encounters

#!/bin/bashFor i in ' cat/home/lee/hosts 'DoSsh-i/home/lee [email protected] $i "Free-m >/root/${i}_memory.txt;/bin/hostname >>/root/${i}_memory.txt"Sleep 1Scp-i/home/lee $i:/root/${i}_memory.txt/root/Sleep 1Doneif [!-f/root/get_memory.txt]ThenTouch/

0 Brother's Linux private cuisine--14th chapter: Bash Shell

Video linkPotatoes:Station B:Directory of this chapter:1. Bash Shell1.1 What is a shell? (We communicate with the kernel core through the shell, enabling kernel to manipulate the hardware)1.2 System shell and/etc/shells function (Cat/etc/shells, you

Shell script 0--all files and pipelines

Pipe: grep foo/path/to/file | Grep-n-K 3 | MoreThe actual process is the opposite of what we intuitively believe, and it is best understood through the actual process. The first thing to run is more, and its input is connected to a pipeline. Then it

Shell implements a springboard machine

Zbuz add users, and bulk distribute SSH public key scripts: #!/bin/bash. /etc/init.d/functionsfunction add_user () {         jumper= "$"         useradd ${jumper}         echo 123456 | passwd --stdin ${jumper} >/dev/ null 2>&1              

Using VI mode in the shell

As a participant in a large open source community, or rather as a member of the Fedora project, I have the opportunity to meet with many people and discuss various interesting technical topics.My favorite topic is "command line" or shell, because

In shell programming if the path name encounters parentheses

In Linux, if the file name is enclosed in parentheses, the parentheses should be processed first, preceded by "\" before "(" and ")". Bracket_handle gives the processing method:Sub Bracket_handle {My ($tmp _name) = @_;$tmp _name =~ s/\ (/\\\ (/g; # (

Shell Foundation--shell Special variables

A. Variable listTwo. ExperimentsSystem: CentOS 71. Special variables[Email protected] ~_~ day2]# cat p.sh#!/bin/bashEcho ' $: ' $Echo ' $*: ' $*Echo ' [email protected]: ' [email protected]Echo ' $#: ' $#Echo ' $1$2$3: ' $1$2$3[[email protected] ~_~

Shell: Regular expressions and text processing

Regular expressionsJob One: organize regular expression BlogsRegular expressionsA regular expression is the rule of a string of characters in a class word.GrepThe grep command is useful in situations where a pattern-based search is performed on the

Linux Base-shell Script

Task one goal: Automatic deployment, initial configuration, and start Nginx reverse proxy serviceSplit the task-the Automatic Deployment section is the first to download the installation NginxFirst, create a very NB-domineering catalogue and a

Loop of shell scripts: repeating commands

Loop of shell scripts: repeating commands1.for CycleGrammar:For variable name in variable Value listDoCommandDoneFor based on the contents of the variable Value list, executes the command repeatedly until all the contents of the Variable Value

Shell Basics (i)

Shell Basics (i)* represents 0 or more arbitrary characters? represents an arbitrary character# Comment symbol, comment description meaning, that is, the content behind the # Linux ignored, or in the shell script to explain the symbol, explain the

Shell and regular expressions

Job One: organize regular expression BlogsHave finished finishing.Job Two: grep jobs (regular expressions and character processing)Target file/etc/passwd, using the grep command or Egrep1. All rows containing root are displayed:[[email protected] ~]#

Shell Entry Information

Collect a simple shell learning document:Link:http://c.biancheng.net/cpp/view/6994.htmlThe shell itself is a program written in C, which is a bridge for users to use Unix/linux, and most of their work is done through the shell. The shell is both a

Package shell scripts into RPM packages

The next best thing to do on a virtual machine: Docker is the most convenient1. Installing RpmbuildYum-y Install Rpmbuild rpmdevtools-y2. Generate a package pathWith Rpmdev-setuptree, a Rpmbuild folder is automatically generated in the user's home

Shell Command Summary

Encountered a remember a1, omit sudoUsing the Su-i command after landing with the primary user will log in as root in the shell, then the command will not need to add sudo and password. Another user has tried, Su does not have the-i option. Online

Shell Note 2

1.Linux default shell is bash,unix default shell is shBash is fully compatible with SH2. Define variables:When defining a variable, the variable name does not have a dollar sign ($), and a variable is used before the variable name plus $There can be

Deletion of variable contents in shell, substitution

Delete ${varname#strmatch}//Match the Strmatch from scratch in varname and then remove the position from the beginning to the first match ${varname# #strMatch}//Match the Strmatch from scratch in varname and then delete the position

Total Pages: 541 1 .... 411 412 413 414 415 .... 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.