Computing.Net > Forums > Solaris > shell script for interactive cmd

shell script for interactive cmd

Reply to Message Icon

Original Message
Name: komanche
Date: April 4, 2007 at 09:19:02 Pacific
Subject: shell script for interactive cmd
OS: Solaris
CPU/Ram: any
Model/Manufacturer: any
Comment:

We want to write a shell script execute a set of commands , the problem is the commands specified in the script ask for user intervention say for eg: if the command is

reset bts-123

when u execute the above command it ask's
"are you sure you want to execute this command"

i want to give a default value of yes to all these , kindly help in creating a script which wud take a value of yes for all the questions.


Report Offensive Message For Removal


Response Number 1
Name: nails
Date: April 4, 2007 at 12:22:23 Pacific
Reply: (edit)

I'm not sure what you want. You can place the answers to the question in a file and redirect that file. Consider an example. I have this test.ss script:

#!/bin/ksh

echo "first prompt"
read x
echo $x

echo "second prompt"
read y
echo $y
# end script

This requires the user to input twice. Now, place the answer to each prompt in a file called prompt.txt:

y
y

Execute this command and the user isn't prompted:

test.ss < prompt.txt



Report Offensive Follow Up For Removal

Response Number 2
Name: jefro
Date: April 4, 2007 at 14:29:50 Pacific
Reply: (edit)

If that doesn't work ( and it should) you might see if you commands have a switch for quiet or null or something like that.

I read it wrong and answer it wrong too. So get off my case you goober.


Report Offensive Follow Up For Removal

Response Number 3
Name: komanche
Date: April 6, 2007 at 13:54:46 Pacific
Reply: (edit)

Thank u guys will try that n revert


Report Offensive Follow Up For Removal

Response Number 4
Name: komanche
Date: April 8, 2007 at 06:47:15 Pacific
Reply: (edit)

thanks a lot the test.ss < prompt.txt solution worked.



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: shell script for interactive cmd

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge