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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

shell script for interactive cmd

Reply to Message Icon

Name: komanche
Date: April 4, 2007 at 09:19:02 Pacific
OS: Solaris
CPU/Ram: any
Product: 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.



Sponsored Link
Ads by Google

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

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



0

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

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.


0

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

Thank u guys will try that n revert


0

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

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



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Solaris Forum Home


Sponsored links

Ads by Google


Results for: shell script for interactive cmd

Shell script www.computing.net/answers/solaris/shell-script/3080.html

Quick shell script question www.computing.net/answers/solaris/quick-shell-script-question/1844.html

shell script to check a dynamic ip www.computing.net/answers/solaris/shell-script-to-check-a-dynamic-ip/4287.html