Service sms.ru. When executing a command

curl -d "msg=TEXT" https://sms.ru/sms/send\?api_id=MY_ID\&to=PHONE

(where TEXT is the sms text that is sent to the phone, MY_ID is the client ID in the service, PHONE is the phone number to which the sms is sent) returns each time the sms is sent to the terminal, the service information about the sending status, client balance, etc. - every time there are three lines without translating the last line, (this is what happens, for example, after two SMS):

100 201830-1000001 balance=8.13100 201830-1000001 balance=8.13

I have an endless script on my remote server that monitors the current state and completes each cycle with the above command when certain circumstances occur and I get sms with the necessary code. It does not suit me that the answers are piling up, in fact, I don’t need them at all there. How can I make the team run, but nothing is returned to the terminal, well, or so that the return is suppressed or somehow invisible?

    1 answer 1

    Good evening

     if [[ ваше условие ]]; then # если нужно сделать невидимым по условию curl -d "msg=TEXT" https://sms.ru/sms/send\?api_id=MY_ID\&to=PHONE &> /dev/null fi 

    If we are talking about * nix and bash shells (not specified), stderr and stdout will be redirected to the "black hole" and will not litter the terminal.

    A small note, you don’t “clutter up” anything if you write to stdout, but if you write to the file, then yes - use some kind of physical-virtual space of your remote server

    Counter issues:

    • script is written on what? bash / perl / python ...
    • are you familiar with: / dev / null,>, <, 2> / dev / null, &> / dev / null