Presently i am trying to do basic checks on my my-sql cluster boxes.
The command ndb_mgm checks for the cluster environment details by typing the show command, and exit to come out of the ndb_mgm command.
Rather, than typing i have made a script abc.sh with the below contents in the below details
more abc.sh
/opt/app/abc/mysql/bin/ndb_mgm < <(yes show)
Here, once i run the script, the above command goes into iteration, and the details of show are shown on the screen in a continuous process,
(i.e:the same data is shown repetedly).Hence i just want to show it once on the screen and do the exit in-order for me to come out of the ndb_mgm command
Can anyone advise me ?
If ndb_mgm - which I don't have at hand to prove the concept - reads from stdin, as read does, you could adapt this one:
LF=$'\n'
while read A B REST; do echo $A $B $REST; done <<< "Hello $LF ABC CDE$LF A B C"
Hello
ABC CDE
A B C
while read A B REST; do echo $A $B $REST; done <<< "show${LF}exit"
show
exit