How to pass parameters to the CT script

Source: Internet
Author: User
How to pass parameters to the login Ct script, for example, the following script is used to perform ssh password-less login, and automatically enter the confirm yes and password information, user name, password, and hostname to pass the ssh. expPython code through Parameters #! /Usr/bin/expectsettimeout10setusername [... how to pass parameters to the login Ct script, for example, the following script is used for ssh password-less login, and the system automatically enters the confirmation yes and password information, user name, password, and hostname to pass ssh through parameters. exp Python code #! /Usr/bin/empty Ct set timeout 10 set username [lindex $ argv 0] set password [lindex $ argv 1] set hostname [lindex $ argv 2] spawn ssh-copy-id- i. ssh/id_rsa.pub $ username @ $ hostname your CT "yes/no" send "yes \ r" your CT "password:" send "$ password \ r" your Ct eof execute the script. /ssh. exp root pasword hostname1 receive CT parameters are received in different ways than bash scripts. bash uses $0... $ n in this way, while CT uses set <Variable name> [Lindex $ argv ], Such as set username [lindex $ argv 0]

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.