Automatic CVS Logon

Source: Internet
Author: User

 

Have you ever encountered any problems that cannot be solved by using shell?

I have met, so I have to learn the language CT that makes up for the disadvantages of shell;

Indeed, interaction is both a shell advantage and a pity.

Two days ago, I had to write a script to automatically connect to CVS because of work reasons. I thought Bash was simple and easy to use. If Bash was not used, I could not automatically log on to the CVS server.

Later, I think it should be because shell itself is a script and you have to make various commands step by step. When you use CVS login, it is done, but now it has transferred control to CVS login after making this commandProgramThe CVS login prompts you to enter the password and determines whether the password is correct or not. In fact, the shell you write is only half done and then jumps to another program for execution. Is there any language that can implement automatic interaction? Of course, the answer is yes.

I wonder, have you ever written a script for FTP Automatic Logon? This is generally the case:

#! /Bin/bash

User = Anonymous
Pass = "cuitggyy@163.com </P"/>

FTP-I-n <End
Open ftp.caldera.com
User $ user $ pass
CD/pub
Ls
Close
End

As you can see, there is a "-I" parameter in the FTP command, which is used to start non-interactive FTP, and the parameter "-n" is used to disable the automatic logon function. In this way, the execution of a job stream is achieved, and the FTP command itself can avoid interaction, but our CVS server does not have such a kind of kindness. For the sake of security, CVS is designed to be an interactive program that can only enter passwords manually. In the same way, there are fsck and so on. Therefore, we can completely write a script to save time.

Fortunately, we also have javasct, a Tcl/TK-based language that can run interactive programs in non-interactive mode, making up for the biggest drawback of shell. In addition, the syntax of keep CT is also very simple. Once you have written a shell, you will understand it. Below is a simple program that automatically logs on to the CVS server, the prerequisite is that the correct cvsroot has been set:

#! /Usr/bin/CT-F
# Cvslogin. exp -- Auto CVS Login
####################

Set timeout 10

Set passwd [lindex $ argv 0]

Spawn CVS Login
Reset CT "* password :"
Send "$ passwd \ r"

Reverse ct eof {exit 0}
Timeout {Exit 1}

Do you understand? In this case, we can also write a similar example of automatically logging on to ssh.

This is my discovery of the secondary CT Chinese Tutorial: http://www.xfocus.net/articles/200104/169.html

At the beginning when I learned CT this tutorial has not come out, you can go to the official site of CT search: http://expect.nist.gov/

In fact, Chinese tutorials are also translated from official tutorials. I hope you can still go to the official tutorials. After all, e can be greatly improved.

I also want to sell my work as soon as possible, but I want to provide an alternative solution to problems for my siblings who have similar problems.

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.