How to handle multiple warning message when we are running any linux application through bash script?
I am running a application through bash script. when we execute the script, application will start and two different warning message ask for [y/n]? for first warning i want to give "Y" and for another "N" but it should take from script only. I don't want to use any user intervention
for single warning we can handle through echo 'y' | command. but how to use for multiple warning handling? Please help
I not sure what you want, but almost for every Linux bash command there are a lot of options. For example if you want to remove a file, Linux will ask you if you really want to do that (if you use this command: #rm -i file2.txt, you will get this prompt rm: remove regular empty file `file2.txt'? y).
To ignore that prompt you can use following option for rm command -f: #rm -f file2.txt where -f means -force
So try to do #man to see if there is an option to avoid prompt.
Pass arguments (Y and N or anything else) to the script call like this...
./script.bash Y N
These can then be accessed in the script (script.bash) with the $1 and $2 variable names. Also you can use $3 $4 .. $N etc.
For example...Script contents
#!/bin/bash echo $1 echo $2