How I know I formed shell-programming habits a long
time ago:
Co-worker was trying to put together some OS-level provisioning-automation for a task he was working on. He was asking how to do some things and I was having to go from memory as I didn't have a suitable Linux host to test command-suggestions on. Guy I was talking to said, "it's ok, I can ask Gemini". He took the results of his search and asked me to look. The code was functional, but far from optimal.
First thing I took issue with was "you're piping grep to
awk: if you stick with a piped-
grep for what you're doing, you should use
cut instead of
awk; if you want
awk, then you can drop the
grep completely". My further plug for
cut was that it's much faster, given that it's 1/15th the size of
awk.
He tried my suggestion and was like "yeah, that was much faster". I reminded him that awk is basically a mini language while
cut is a very simple tool. And that, for his use-case, while
awk will do the trick, it was massive overkill.
Score one for the elderly SA versus Gemini!
#linux
#automation
#scripting
#bash
#grep
#awk
#cut