aspose file tools*
The moose likes Linux / UNIX and the fly likes Script Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Script Help" Watch "Script Help" New topic
Author

Script Help

Satish Kulkarni
Ranch Hand

Joined: Jul 19, 2003
Posts: 60
Hi,
There is a install script(install.sh) for installation of our product and I am working on automating the process of installation using ksh script.
But the problem is that the install script does a "more" command on a file and then asks few questions..I do not know how to handle the "more" command.
Any help would be appreciated.

I am pasting a dummy install.sh script and my auto.sh script
-------install.sh------------#!/bin/ksh

DIR=`pwd`
LIC_FILE=$DIR/lic
LOGFILE=$DIR/log

log ()
{
DATE=`date '+%m/%d/%y %H:%M:%S'`
echo "[${DATE}] $1" >> $LOGFILE
}

ifYes ()
{
echo ""
/bin/echo "$* [Yes]: \c"
read ans
case $ans in
""|[yY]*) return 0 ;;
*) return 1 ;;
esac
}

if [ -f $LOGFILE ]; then
rm -rf $LOGFILE
fi

more $LIC_FILE

if ifYes "Are you Testing POP?"
then
log "Good luck for POP ...continue"
else
log "Not POP.Good Day"
fi

if ifYes "Are you testing NetConnect?"
then
log "Good luck for NetConnect..."
else
log "Not NetConnect.Good Day"
fi

------auto.sh---------
#!/bin/ksh

DIR=`pwd`

OUT=$DIR/log

$DIR/install.sh << EOF
Y
Y
EOF
Petr Blahos
Ranch Hand

Joined: Apr 28, 2004
Posts: 131
And what exactly do you mean by 'handle the "more" command'?!?

If you want to automate the script, make it accept a parameter
--silent which when used skips the interactive parts.

P.


Get a better web browser:<br /><a href="http://www.mozilla.org/products/firefox/switch.html" target="_blank" rel="nofollow">http://www.mozilla.org/products/firefox/switch.html</a>
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

I don't have ksh, so I tried (successfull with bash):

It filters out the annoying more, makes the filtered file executable and executes that.

You may stop more interactively with 'q', but that didn't work in the redirection-part.


http://home.arcor.de/hirnstrom/bewerbung
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Script Help