3 ms·
I can't really make out what you're trying to say, either. I'm asking you if you think that file oriented shells like sh, csh or bash (or any Unix shell short
by DonHopkins 8y ago
I can't really make out what you're trying to say, either.
I'm asking you if you think that file oriented shells like sh, csh or bash (or any Unix shell short of Perl, Python, Emacs or node.js) are reasonable scripting languages for plugging together software components, the way PowerShell is.
For example, PowerShell lets you pass around an array of filenames, and doesn't blow up if there are spaces in the file names the way the shell does. PowerShell enables software components to export and consume rich well defined APIs that take and return actual objects and data structures, not just strings of text that you then have to parse on your own.
Even though it would be extremely useful, Unix shells are absolutely terrible at parsing text and manipulating data structures, and have to call out to other weak programs like sed and awk to do even the most rudimentary parsing, pattern matching and string manipulation.
Historically and until recently, Unix shells weren't even able to add two numbers: you actually had to run another program called "expr" to do that, and forking another process and parsing its string output is ASTRONOMICALLY less efficient that executing an ADD instruction. Unix shell scripting is pathetically wasteful and inefficient, and a huge pain in the ass to program, read and maintain.
https://www.tutorialspoint.com/unix_commands/expr.htm https://www.tutorialspoint.com/unix_commands/expr.htm
The following is an example involving boolean expressions ( |- or operator ):
$ expr length "abcdef" "<" 5 "|" 15 - 4 ">" 8
output:
1
Everything is NOT a file. You shouldn't have to fork another process and parse a file to add two numbers, or put double quotes around your logical operators for that matter. Plan 9 got it dead wrong. And that's why nobody uses Plan 9, and why modern Unix isn't anything like it.
I get it that you're in a reflexive tizzy about how evil and corporate everything from Microsoft automatically is in your book. But I'm afraid you simply don't know what you're talking about.
Since you're not able to talk about PowerShell rationally, then what about Python or Emacs? They're real programming languages, not lame mish-mashes of haphazard syntax and inconsistent semantics like Unix shells, and they don't view everything as a one-dimensional file like Plan 9 insists. They have actual libraries with real APIs and honest to god objects and data structures, not just files. In Emacs Lisp, files actually have their own local variables, containing any Lisp objects or s-expressions.
http://www.gnu.org/software/emacs/emacs-paper.html#SEC19 http://www.gnu.org/software/emacs/emacs-paper.html#SEC19
And if you really continue to insist that everything should be represented as one-dimensional file, then how to you explain ioctl and fcntl and setsockopt?
The official error code returned by ioctl sums up my point about Plan 9's fatal mistake: ENOTTY: NOT A TYPEWRITER.
https://en.wikipedia.org/wiki/Not_a_typewriter https://en.wikipedia.org/wiki/Not_a_typewriter