I need to convert the ping command to string on MacOS terminal for the following task:
I recently started using the telegram-send command which is basically a way to send messagess on telegram via the MacOS Terminal. I want to use the terminal to send the result of my ping to my telegram account (to basically monitor its uptime).
This is how the telegram-send command works:
telegram-send "hello world"
and I'd like to it function in a way that I could get this result:
telegram-send ping 192.168.1.1
but obviously the command above wouldn't work because whatever comes in front of telegram-send will be sent as string.
Any suggestions?
Best Answer
Depending on the shell you're using, you can do it like this: