Ein Enter an einen shell Befehl senden – send a return to a shell command

Some of us especially the ones working in a high automated administrative environment have the need to write shell scripts issuing commands. Some of these commands like passwd or other binaries from 3rd party vendors expect you to press the enter key or an abort key stroke for continuing or aborting the operating. One of the solutions out there is using expect to do this, but I wanted to avoid installing a further binary on my productional environment. So I googled around and found a solution which works fine for me. You can send any commands/character combinations to a shell command. e.g. echo -ne ‚\n‘ | crawleradmin -d $tmpCollection sends an enter to the command I issue afterwards and guess what happened, it worked. So use this method if you need it but ensure you test it in advance to avoid nasty sideeffects.

Advertisements

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s