3 ms·
When you say trivial, do you mean (roughly)?: - get input from the user - pipe it to a subprocess [1] -- ex. subprocess.call("somecmd", shell=True) - show ou
by tedmiston 10y ago
When you say trivial, do you mean (roughly)?:
- get input from the user
- pipe it to a subprocess [1] -- ex. subprocess.call("somecmd", shell=True)
- show output to the user
- run this all inside a while true loop
Is it "cheating" to do it this way? Should the shell be responsible for parsing a language, generating an underlying representation like an abstract syntax tree, etc?
I'm speaking from the Python perspective but of course this idea is about the same in any very high level language.
[1]: https://docs.python.org/2/library/subprocess.html#using-the-subprocess-module https://docs.python.org/2/library/subprocess.html#using-the-...
- DougMerritt 10y agoYes, that is precisely what I mean by trivial; the things needed are builtin to the Ruby/Python/Perl languages + standard class library, which makes it very easy. > Is it "cheating" to do it this way? Should the shell be responsible for ... Depends on your goals. There is no absolute answer. If you just want to get things done fast, use Ruby. If you want to understand what Bash does, and learn more about systems programming, then do it the long way.