Useful Bash Scripts
I don't know when or how I'll use all of these, but I love the scripts listed here.
Some that caught my eye:
boop (an alias, not a shell script) makes a happy sound if the previous command succeeded and a sad sound otherwise. I do things like run_the_tests ; boop which will tell me, audibly, whether the tests succeed. It’s also helpful for long-running commands, because you get a little alert when they’re done. I use this all the time.
nato bar returns Bravo Alfa Romeo. I use this most often when talking to customer service and need to read out a long alphanumeric string, which has only happened a couple of times in my whole life. But it’s sometimes useful!
murder foo or murder 1234 is a wrapper around kill that sends kill -15 $PID, waits a little, then sends kill -2, waits and sends kill -1, waits before finally sending kill -9. If I want a program to stop, I want to ask it nicely before getting more aggressive. I use this a few times a month.
tryna my_command runs my_command until it succeeds. trynafail my_command runs my_command until it fails. I don’t use this much, but it’s useful for various things. tryna wget ... will keep trying to download something. trynafail npm test will stop once my tests start failing.
ds-destroy recursively deletes all .DS_Store files in a directory. I hate that macOS clutters directories with these files! I don’t use this often, but I’m glad I have it when I need it.