Skip to main content
6 events
when toggle format what by license comment
Dec 20, 2017 at 9:13 comment added ilkkachu well, simplicity depends on the context and on how familiar the thing is to someone. Judging by most questions here, not too many know the difference between $@ and $*, let alone to use $* as a synonym for "join". So in the context of a Q where someone tried the straightforward implementation, but still forgot a function call, I'm not really sure that's "simple". Especially since you didn't give any explanation or reference. Stuff like $* or <<< is next-to-impossible to search for...
Dec 20, 2017 at 5:07 comment added Wildcard Point being: nearly all errors people make in writing shell scripts are based on the fundamental misconception that the shell is a typical programming language like many others, when it's really not—at all.
Dec 20, 2017 at 5:05 comment added Wildcard @ilkkachu, to quote Stephane Chazelas: "In C or most other languages, building blocks are just one level above computer instructions. You tell your processor what to do and then what to do next. You take your processor by the hand and micro-manage it: you open that file, you read that many bytes, you do this, you do that with it. Shells are a higher level language. One may say it's not even a language. They're before all command line interpreters. The job is done by those commands you run and the shell is only meant to orchestrate them."
Dec 20, 2017 at 4:59 comment added ilkkachu right, my point was mostly on features that are similar to other programming languages vs. somewhat quaint features specific to the shell language.
Dec 20, 2017 at 4:46 comment added Wildcard @ilkkachu, sure, well, the other approach is only simple if you know that bash functions don't have their own variable scope (when defined with curly braces), if you know how "$@" and for num do interact, if you understand arithmetic expansion AND how and why $ is not needed therein, AND if every future reader of the script knows all of that, too! :P
Dec 20, 2017 at 3:46 history answered Wildcard CC BY-SA 3.0