Answer Terminal Questions With Shell Script?

First off, I am using Mac OS X, with Apple Remote Desktop.

I have to install several app's on teachers' laptops which are on several cd's that I have made disk images of. (DMG's)

To do rollouts quicker, I have written a script to mount the disk images and running the installers inside each of the disk images (this is not done yet, but in progress)

Here's the script.

#!/bin/sh

#Version .1a, by XXXXXXXX

##Installer script for TeacherEXPRESS apps and expansion packs

##First, mount the DMG files

##Usage: hdiutil mount AppName.dmg

cd /

##Change to /Science for final run
hdiutil mount /Install_Teacher_express.dmg
 

Now when I run the script I get:

Are you sure you want to mount the image? (Y/N)

Is there a way for me to answer Y?

Try this:

echo "Y"| hdiutil mount /Install_Teacher_express.dmg

Regards

hdiutil mount /Install_Teacher_express.dmg | echo "Y"

is the command I used.

It Worked! Thanks a bunch.

man yes

make file with all answers (no only Y, for example - with path or your name)
and can automatize installation any software :slight_smile:

# printf "y
Yes
Yes
n
/path/to/file
" > /tmp/answers
# my_script.sh < /tmp/answers