#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    1
    Rep Power
    0

    interactive scripting


    Hi

    I am very new to UNIX scripting and want to do something that I hope is pretty simple ...

    Is there any way to allow a UNIX script to execute interactive commands inside a non-unix program? For example, I have a program called 'smart' that is called with the following instruction at the command-line ...

    smart inter spec

    which then presents a prompt to the user in the form

    Smart(ntq?):

    and the user is expected to enter the next instruction (i.e. n, t or q).

    I want to write a script that will execute the first 'smart inter spec' part, which I have, and works fine, and then execute a command at the Smart(ntq?): command prompt, without requiring any user interaction. I suppose in a way, this is similar to the "-f" (force) option on the "mv" command.

    Is this at all possible?

    Thanks in advance

    Ryen

    P.S. For those interested, SMART is an experimental search system used in information retrieval research
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    Unless it was intentionally blocked (eg. with ssh or password this could be the case), you can "pipe" commands to another program and it will treat it like if somebody typed it.
    eg.:

    echo -e "t\n" | smart

    (the -e tells it to interpret the "\n" which resembles a RETURN)

IMN logo majestic logo threadwatch logo seochat tools logo