linux - checking condition then auto answer questions -


I have a question:

If this is a way of checking the status, then auto answer questions such as < What happened in Code> Hedoodock ?

I know that we can answer two questions (examples are given by the passwd command, for example):

1 ) Piping

  & lt; Password & gt; | Passwd & lt; Username & gt;   

2) heredocs passwd & lt; Username & gt; & Lt; & Lt; EOF & lt; Password & gt; & Lt; Password & gt; EOF

Now, Question :

How to keep a condition to answer them ///

  if ['password' - EC 0]; Then & lt; & Lt; EOF & lt; Password & gt; & Lt; Password & gt; For example, this is not possible, any thoughts?  
  #! / 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 & lt; & Lt; EOF OK EOF Elif [$? -a 0]; Then & lt; & Lt; EOF failed EOF fi   

heredocs and piping or any other solution is welcome,

I first I want to check the terms that are capable of answering questions

thanks

Hope could be with the command?

Few examples with FTP because I am not familiar with mdadm. You can see that it is slightly different depending on the response from the server - which is, I think what you are trying to do.

  Connect to FTP server using the # "spawn" command. Spawn ftp $ hostname # Wait for the login prompt. --Ray "(name | login | login | username). *:. *" {# Login prompt received. Send user name to the server Exp_send "$ username \ r" exp_send_user "user name was sent \ n"} eof {# no login prompt received an error display Exp_send_user "Could not connect \ n"}    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -