I constantly use
ping to verify how’s my connection doing. Today I got sick from these prompts, because I’m used to seeing a piece (usually the beginning) of the terminal window, and the “useful” information with this output is at the end. So, in most of the cases I see this picture (you can see how annoying it is):
Of course, I would have gone nowhere without ChatGPT. My scripting skills are quite basic, so I decided to use ChatGPT for help. Starting with the initial code above, but with the help of “the still good transformer,” I finally have a
ping.sh, which outputs what I needed. It has the following benefits:
- It outputs the result first thing in the row, with the data that I care about, so I can keep it squeezed somewhere on the screen without the need for a bigger real estate:
- It can quit on a key press. This required
zshfor MacOS, but I’m OK with this limitation.
- I can add more hosts if I need it (the default script had this possibility, so I inherited it). This also revealed a bug: for some reason when there was more than one hostname, it didn’t work with the initial list (as a string). I had to do it the “
Conclusion: ChatGPT rules (and really helps), and I finally have my
ping in the way I always wanted.