3 ms·
It is a reason to “just use Python” for scripting, or Java or C for that matter.
by PaulHoule 3y ago
It is a reason to “just use Python” for scripting, or Java or C for that matter.
- 13of40 3y agoThey have powershell on those unix computers nowadays. Just sayin'.
- rcme 3y agoI-Don’t-Want-All-My-Commands-To-Be-This-Long
- 13of40 3y agoGet-Alias
- shortrounddev2 3y agoThere's aliases, and you can just hit tab to autocomplete the commands and their argument names. I find Powershell to be far more readable than bash because of its verbosity
- rcme 3y agoAliases aren’t portable
- vips7L 3y agoI don’t think I’ve ever seen a portable posix shell script. They all rely on bash-isms and gnu binary behavior
- shortrounddev2 3y agoPersonally I don't write portable shell scripts. They exist only for my own usage on my desktop. If we rely on any kind of script for deployment purposes at work, we use the scripting lang in the build system or a python script
- Const-me 3y agoInterestingly, I actually do. When I write bash scripts which will go to git and probably stay there for a while, I use long form of the switches, like --long-option-name instead of -lon. They make the script more readable when after a year someone wants to modify it.
- diarrhea 3y agoI use long options always, even going through the pain of typing them out when to tab completion is available. Exceptions are truly trivial things like ls. It allows things like history | fzf to work very well.
- mbwgh 3y agofzf comes with some bash completions (https://wiki.archlinux.org/title/fzf https://wiki.archlinux.org/title/fzf), including Ctrl+r for basically `history | fzf`.
- dspillett 3y agoIt is nice for maintaining scripts though. While short names and options are typing-savers interactively (though sometimes problematical when a single character typo can radically change the meaning of a command in a way that means it is still a valid command so will be executed) in scripts I want long names so people after me (including future me) can understand without reference to man pages or similar. OK, the same could be achieved with copious comments, but then you have lots of pairs of bits of text to keep in sync.
- seadan83 3y agoI was once asked in an Amazon interview a famous problem of theirs, find all phone numbers on their website. This was a real world problem they ran into. The first engineer there went about it in java, took days and pages of code (and still various corner cases were issues, it was slow, etc..) Another came along, threw down a few lines of shell and was done. There are some things shell does really well.
- jks 3y agoThis reminds me of the story in which Don Knuth wrote a literate program in WEB (reportedly over 10 pages) to do some text processing and Doug McIlroy did the same thing in a six-line shell script: http://www.leancrew.com/all-this/2011/12/more-shell-less-egg/ http://www.leancrew.com/all-this/2011/12/more-shell-less-egg...
- cb321 3y agoKnuth was asked to demonstrate his new literate programming and probably thought an 8-page mini-paper was about the right "length" to do so: https://buttondown.email/hillelwayne/archive/donald-knuth-was-framed/ McIlroy was asked to show off productivity in the newly popular Unix system, and he did that. While often framed as "a contest" the two approaches are really solving different enough problems as being apples-oranges. So, the only meaningful judgement of a contest is "who better achieved their narrow goals?" I've found in discussions with people that they seem unable to separate their judgement of "a winner" from their own personal weight on the value of the two narrow goals ("detailed articulation mixing code & text" vs. "just getting shit done"). There is probably some broader lesson about people in that (and indeed probably a specific term in the science of psychology) - those who really like apples or really like oranges being inclined to force a non-contest into one of their favored "Eat oranges!" rhetorical moves. EDIT: and it's actually even more subtle - the very same person can side with either depending on broader context or framing. There are those who would praise detailed documentation over write-only hacks requiring detailed memory of tool innards in one situation yet decry it as a waste of time in another. (All part of why survey results are not to be accepted naively.)
- fbdab103 3y ago