LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Shell script to input values to a utility automatically at the prompt (http://www.linuxquestions.org/questions/linux-newbie-8/shell-script-to-input-values-to-a-utility-automatically-at-the-prompt-4175417218/)

sunrexstar 07-17-2012 12:28 PM

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.

sharadchhetri 07-17-2012 12:56 PM

Quote:

Originally Posted by sunrexstar (Post 4730727)
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:~#


All times are GMT -5. The time now is 10:44 AM.