|
|
|
|
|
by bsdetector
1327 days ago
|
|
Having written a lot of shell scripts, the single greatest thing I've ever experienced is shell-friendly outputs. For example, consider if ls had a "--shell" option that output each entry as a single line of shell-quoted variables safe for eval: # cd /usr/share/dict
# ls --shell words
path="/usr/share/dict" file="words" user="root" group="root" size=985084 ...
Then all sorts of things become easy. # eval $(ls --shell words); echo "$size" "$file"
This nushell doesn't really change anything important about this biggest scripting problem. You're still parsing human readable output and it's still dependent on particular versions and options passed.If I had a genie wish of nushell being installed everywhere or even just coreutils having a --shell option I'd take the latter any day. |
|
The POSIX shell has that in the form of globbing. That only gives you names, and has quirks that are only adequately worked around with Bash options.
The fix is to use some real programming language for complex work.
I made a language for myself in this space, geared toward C and Unix people who are willing to try Lisp: TXR.