How to provide auto inputs for a sub-script within a script?
Hi All,
I am writing a shell script.
In above script I am trying to add below predefined script/command (/var/tmp/db_tools)
This command in turn ask for user input, which will be always option 13 in my case.
Then User has to give '0' and at last exit
So three inputs need to give everytime whenever script/command (/var/tmp/db_tools) is running.
Please suggest how to append above.
Do you want to automate running the switch-user and the db_tools? You could perhaps:-
If you want to add a function to the db_tools scripts, we will need to see the script to know how it is laid out. Hopefully, there is a menu display, an input request and then a case statement, in which case we can add the function easily.
Can you help me out and explain what you are after?
It would be good to know the OS and version as some tools may have differences.
Why not simply modify the db_tools script so that it no longer asks for user input but takes the defaults that you want?
-> Because the db_tools script is the standard for all the user.
But whenever I want t use this script it should take the my inputs i.e 13, 0 and exit.
You could trying using a heredoc. Or if you need to do something more complex (like verifying responses) then look at expect.
-> heredoc and expect, I am not sure because this is the linux server where I cannot add any expect command tools.
Do you want to automate running the switch-user and the db_tools? You could perhaps:-
1st I want to run the "su - sybase" and then the "/var/tmp/db_tools" and provide the fixed inputs in the same sequence as "13, 0 and exit."
If you want to add a function to the db_tools scripts, we will need to see the script to know how it is laid out. Hopefully, there is a menu display, an input request and then a case statement, in which case we can add the function easily.
-> I dont want to add any finction.
My basic requirement is to run script as follows example :-
I am running below script with root user
Thank You all for the reply and my apologies if something is not clear.
Regards,
Madhur
Last edited by Don Cragun; 03-05-2014 at 06:37 PM..
Reason: Add CODE tags.
Then I think that my first suggestion has a chance of succeeding. What do you get from:-
Are there any errors? Do you get the output you need in logfile?
• With this script, users will be able to
o Enter into the recycle bin mode. During this mode, all files deleted will be sent to the recycle bin. The recycle bin will be common to all users.
o View contents of the recycle bin (his/her file(s) only).
o Retrieve a particular file from the recycle... (3 Replies)
Hi All,
I am a novice to UNIX, i need to know is there a way to provide 2 inputs when the shell prompts and i need to assign those 2 values to 2 separate variables. I dont want to give those values as a arguments (while running the script).
Thanks in advance!! (1 Reply)
so i'm have been stifled here inn my attempts at this.
i need to calculate an unusual figure.
what is the percentage difference between 400 and 3?
usually, to get the percentage, you just divide the smaller number by the bigger number. then multiply the answer by 100.
in this case... (10 Replies)
Dear all
I have a scripts call "script.sh", that I need to provide 3 params from stdin
i.e.
# script.sh
Please input first name : Hello
Please input last name : Kitty
Please input sex : F
Without changing script.sh, I want to write another script call "script_slient.sh", that will... (6 Replies)
Hi. I wanted to create a Perl script which can take the outputs of a Perl script as it's input and temporarily store them in a document. Need help.
Thanks.:) (8 Replies)
Hi frnds
Im new to unix. I have an xml like the following:
<?xml version="1.0"?>
<serviceFeeDetail>
<Data>
<totalAmount>40</totalAmount>
</Data>
<serviceFee>
<invoiceBillGrpNbr>1</invoiceBillGrpNbr>
<serviceFeeLineItem>
<billLineNbr>1</billLineNbr> ... (2 Replies)
Hi guys.
I m creating scripts which input multiple value , inside sqlplus script when it prompt/accept
do anybody know how to provide multiple value inside sqlplus script when it prompt.
like,
enter value for first:
enter value for second:
enter value "save file as " :
I m try... (11 Replies)
HI ,
I have a list1 which consists of data that i have to search and a list2 which has the files that need to be searched .So basically i am using list1 on list2 to see if list1 data is present if found replace it .I have written the code using foreach loop for each list .This is taking the... (1 Reply)
Hi all,
passwd <username> < /var/adm/passwd.txt
cat /var/adm/passwd.txt
abcd1234
abcd1234
when I run this from the script, it comes with:
New password:
It is not able to pick from the location /var/adm/passwd.txt.
thanks in advance. (6 Replies)
Hello All!
I am looking to build a monitoring script.
The script should always run as a system service of some type and should always check that a PHP script is running.
Maybe there is a way to assign a PHP script to a certain PID so that the monitor script that check for the PID in top... (4 Replies)