bash - Auto yes to raid5 array script -


I am working on a script to install an array RAID5. I'm having trouble putting the auto = yes when the script asks: If I want to continue making the array. I tried it - yeah = yes (), but where this place is, it is very uncertain.

  #! / Bin / bash mdadm mdadm --create --verbose / dev / md0 --level = 5 --raid-devices = 3 / dev / sdc1 / dev / sdd1 / dev / sde1 - spare-device = 1 / dev / sdf1 If [$? -E 0 0]; Then OK, OK, Echo FAIL FI   

1) can use to solve such problems.

For example passwd command:

  #! / Bin / bash passwd user & lt; & Lt; EOF Mypassword mypassword EOF You can run your script and enter  heredoc :  
  ./ script & lt; & Lt; EOF & gt; ; Yes & gt; Yes & gt; No & gt; EOF   

Update:

Finally, whatever you want

Has a question:

  ./script & lt; & Lt; EOF & gt; Yes & gt; EOF   

In addition to this you can:

  #! / Bin / bash mdadm --create --verbose / dev / md0 --level = 5 --raid-devices = 3 / dev / sdc1 / dev / sdd1 / dev / sde1 --spare-devices = 1 / dev / sdf1 & Lt; & Lt; EOF Yes EOF   

2) There is another solution:

  yes | Command-It-Ask-In-Input   

Or, if any capital 'Y' is required:

  Yes Y Command-to-Ask-In-Input    

Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -