Shell script login template description, shell script Template

Source: Internet
Author: User
Tags ssh server

Shell script login template description, shell script Template

Write notepad and change the file suffix to sh

#! /Usr/bin/CT

# Log on to ssh

# Use the ssh server spawn in combination with Alibaba CT and send

Spawn ssh root @ ip

# Expectation

Reset CT "password :"

# Enter the password and click Enter \ n

Send "tktktktkt \ n"

# Izhp1_z74iw8bsizduk8mdz

CT "izhp1_z74iw8bsizduk8mdz :"

# Input ls/

Send "ls/\ n"

# Expectation

CT "izhp1_z74iw8bsizduk8mdz :"

# Input

Send "cd/usr/local \ n"

# Expectation/home

CT "/usr/local"

# Input ls

Send "tar-xvf jdk1.8.0_151.tar \ n"

# Expectation

CT "/usr/local"

# Input content to the file

Send "cd/etc \ n"

# Expect etc

CT "/etc"

# Input the configuration environment to the profile

Send "echo export JAVA_HOME =/usr/local/jdk1.8.0 _ 151> profile \ n"

# Expect etc

CT "/etc"

# Input the configuration environment to the profile

Send "echo export CLASSPATH =. :/usr/local/jdk1.8.0 _ 151/lib/dt. jar:/usr/local/jdk1.8.0 _ 151/lib/tools. jar> profile \ n"

# Expect etc

CT "/etc"

# Input the configuration environment to the profile

Send "echo export PATH =/usr/local/jdk1.8.0 _ 151/bin: \ $ PATH> profile \ n"

# Input the system to reload the configuration file

# Expect etc

CT "/etc"

# Reload the configuration file

Send "source profile \ n"

# Enter java-version to check the jdk Environment

# Expect etc

CT "/etc"

# Reload the configuration file

Send "java-version \ n"

# Stay on the server

Interact

Related Article

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.