Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: single line reply



Hi Michael,

I'm not sure if shell scripts can deal with interactive applications properly.
Expect is a scripting tool built specifically for interactive use.
It's open sourece, I use it on unix platforms but I'm not sure if anyone's ported it to
osx yet.

However, if you don't want to use expect then there are alternatives to using
interactive commands (ie. ftp, passwd)

1. Use scp (installed on OSX already by default) instead of ftp. Set up keypair
authentication instead so that it logs you in automatically (ie: doesn't prompt you for
userid or password)

2. Manipulate the netinfo dB directly to change the passwd entry using the "niutil"
command in your shell script.

from "http://expect.nist.gov/";

Expect is a tool for automating interactive applications such as telnet, ftp, passwd,
fsck, rlogin, tip, etc. Expect really makes this stuff trivial. Expect is also useful
for testing these same applications. And by adding Tk, you can also
wrap interactive applications in X11 GUIs.

Expect can make easy all sorts of tasks that are prohibitively difficult with anything
else. You will find that Expect is an absolutely invaluable tool - using it, you will be
able to automate tasks that you've never even thought of
before - and you'll be able to do this automation quickly and easily.

Ryan

> --__--__--
>
> Message: 6
> Date: Mon, 29 Apr 2002 12:24:06 -0400
> Subject: single line reply
> From: Michael Johnson <email@hidden>
> To: email@hidden
>
> I'm trying to get some ideas down for shell scripting, but I don't know
> enough to make one thing work. Using something like passwd for example,
> when you tell it you want to change a password and type:
>
> passwd username
>
> the system brings up a prompt asking for the new password. Then, it
> wants to confirm it (logical choice).
>
> Or using ftp and an example...
>
> ftp ftp.domain.tld
>
> the application will ask for a login and then after that's entered, ask
> for a password.
>
> If I wanted to script something to automatically log in to an ftp server
> and upload a file, how would I do it with a single command string on one
> line?
>
> -Michael
>
> --__--__--
_______________________________________________
macos-x-server mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macos-x-server
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.