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
     vncviewer 192.168.1.102:3
      "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 http://www.realvnc.com for information on VNC.

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

<options> are standard Xt options, or:
             -shared
             -viewonly
             -fullscreen
             -passwd <passwd-file>
             -noauto
             -encodings <encoding-list> (e.g. "raw copyrect")
             -bgr233
             -owncmap
             -truecolour
             -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.

-J.P.

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 die.net, so you can search via this syntax:

man vncviewer site:die.net

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.