• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Script Help

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic