shell script question

Forum: water cooler
Topic: shell script question
started by: kagrecu

Posted by kagrecu on Aug. 23 2005,22:40
how can i automate logging in when i'm writing little shell scripts?  specifically, some examples would be to su to root, enter the root pwd and then do a find command on the whole filesystem.  another would be to run a vncviewer with a certain ip, and pipe in the password automatically.  

eg  #!/bin/sh
      "pipe in password here for the vncauth window"

i know, i know.  this is dangerous, but i'm only going to do these types of things locally, behind a firewall

Posted by SaidinUnleashed on Aug. 24 2005,01:40
Code Sample
dsl@box:~$ vncviewer --help
VNC viewer version 3.3.7 - built Nov 16 2003 08:08:33
Copyright (C) 2002-2003 RealVNC Ltd.
Copyright (C) 1994-2000 AT&T Laboratories Cambridge.
See for information on VNC.

usage: vncviewer [<options>] <host>:<display#>
      vncviewer [<options>] -listen [<display#>]

<options> are standard Xt options, or:
             -passwd <passwd-file>
             -encodings <encoding-list> (e.g. "raw copyrect")
             -depth <depth>

Please try to use the --help flag for a program before asking questions about run-time options, it usually has the info you need.


Posted by mikshaw on Aug. 24 2005,01:50
added for future reference....
some programs use "-help" or "-h" instead of "--help".

Posted by cbagger01 on Aug. 24 2005,16:06
While we are on the subject, another way to get information is to search google for the man page of the program. In other words, search keywords like:

man vncviewer

My personal favorite for man pages is a site called, so you can search via this syntax:

man vncviewer

Posted by Grim on Sep. 09 2005,23:53
You're looking for `expect'.  Most people don't use expect anymore but, it used to be real handy for use with minicom to dial-up to your isp.

There's a bit of a learning curve (say ten to fifteen minutes) but you can automate a whole bunch of stuff with it.

I don't have a url for documentation, but a quick google should find some stuff.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.