I don't think its that surprising. Bash is old as dirt and scripts by definition are meant to be simple. Where AI struggles is when you add complexity like object-oriented design. That's when the effect of it trying to solve every problem in a way unique to it just takes shit off the rails. LLMs known design patterns exist but they don't know how to use them because that's not how deep learning approaches problem solving.
FYI, you're missing two patterns that allow the `--key=value` admirers and the `-alltheshortopsinasinglestring` spacebar savers among us to be happy (for the otherwise excellent options parsing code).
shopt -s extglob
case "$1"
# Flag support - allow -xyz z-takes-params
-@(a|b|c)*) _flag=${1:1:1}; _rest=${1:2}; shift; set -- "-$_flag" "-$_rest" "$@";;
# Param=Value support
-?(-)*=*) _key=${1%%=*}; _value=${1#*=}; shift; set -- "${_key}" "$_value" "$@";;
esac
im not saying OP did this, but I've actually had AI spit out some pretty stellar bash scripts, surprisingly
I don't think its that surprising. Bash is old as dirt and scripts by definition are meant to be simple. Where AI struggles is when you add complexity like object-oriented design. That's when the effect of it trying to solve every problem in a way unique to it just takes shit off the rails. LLMs known design patterns exist but they don't know how to use them because that's not how deep learning approaches problem solving.
No, you're right. It was a pretty collaborative effort with me and Claude!
FYI, you're missing two patterns that allow the `--key=value` admirers and the `-alltheshortopsinasinglestring` spacebar savers among us to be happy (for the otherwise excellent options parsing code).
For letting me know! Would you like to create a PR? Otherwise I'll add you as a Co-Authored-By!
Co-authored is fine, thanks for asking!
Gesundheit
The emojis give it away
Nah - as you'll see from my work from a pre-coding agents age, I like emoji :)
Here are receipts some from 2020: - https://github.com/AnandChowdhary/bsc-thesis - https://github.com/AnandChowdhary/slack-netlify-trigger - https://github.com/AnandChowdhary/analytics-icons