LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-17-2012, 11:28 AM   #1
sunrexstar
LQ Newbie
 
Registered: Feb 2011
Posts: 9

Rep: Reputation: 0
Shell script to input values to a utility automatically at the prompt


Hi,
I have a tool which does a Write to a SAN disk based on user input values. this tool is mainly used to test the IO to the SAN array.
When we run the tool, it prompts for several user values like :
Thread count, threshold value, number of iterations, etc,.

Now, i want to automate this process using a shell script.
This script should basically input all the default values (hard coded) to the tool without asking for the user to input these values at every prompt.

So, what command can i use in a shell script which does automatic inputting of the value to the tool at the prompt instead of waiting for the user to input the values.

Thanks in advance.
 
Old 07-17-2012, 11:56 AM   #2
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Rep: Reputation: 23
Quote:
Originally Posted by sunrexstar View Post
Hi,
I have a tool which does a Write to a SAN disk based on user input values. this tool is mainly used to test the IO to the SAN array.
When we run the tool, it prompts for several user values like :
Thread count, threshold value, number of iterations, etc,.

Now, i want to automate this process using a shell script.
This script should basically input all the default values (hard coded) to the tool without asking for the user to input these values at every prompt.

So, what command can i use in a shell script which does automatic inputting of the value to the tool at the prompt instead of waiting for the user to input the values.

Thanks in advance.
You can use arguments in bash script.

eg.

Quote:
root@tuxworld:~# cat test
#!/bin/bash
x=$1
y=$2

echo "you putted $x and $y in arguments"
root@tuxworld:~# ./test red white
you putted red and white in arguments
root@tuxworld:~#
root@tuxworld:~# ./test
you putted and in arguments
root@tuxworld:~#
in this I have not given any value so that field is blank

Quote:
root@tuxworld:~# ./test
you putted and in arguments
root@tuxworld:~#
 
1 members found this post helpful.
  


Reply

Tags
automatic, command, input, prompt, shell script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script, Perl script, command or utility to convert Binary to text Perseus Programming 26 07-12-2012 06:00 AM
Shell script to prompt for input kent2612 Linux - Newbie 11 06-23-2011 02:38 AM
shell scripting for accepting input from different directories automatically kswapnadevi Programming 2 11-10-2010 12:11 PM
Shell Script: want to insert values in database when update script runs ring Programming 2 10-25-2007 10:48 PM
Script to input values into firefox. WhiskeyTangoFoxtrot Programming 5 11-01-2006 12:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration