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
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.
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.
Summary: I need to write a shell script which passes URL(say:localhost:80) and get the content(say "Hello world"),hostname,date and time stamp to test different components (say apcahe web server). I need to ca...
Summary: Hi All, Quick, easy question from a lowly DBA who knows very little about shell scripting! I've got a script which strips out dodgy characters from import files, and I want to build in a simple condit...
Summary: Hi, I need a shell script to check a dynamic ip(from cable company), it will send the ip to my email if the ip changes. The Solaris box is behind the router with a static ip (internal), the router con...