-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with executing bash commands ( bash cat $(which marcel) ) #24
Comments
I expect from a shell to be able to run any executables with any to them passed arguments according to the POSIX standard. More or other features are welcome, but the basic functionality must be there ... or is the marcel shell concept not in harmony with this expectation all other shells I have tried meet without any problems? If I can't run any executable with any set of arguments like parameter, flags and options from command line, the application running in the Terminal can't be considered to be a shell ... it's then a Terminal shell-like application, but not a shell, right? |
I've attempted to support the "escape" to bash without requiring the entire command to be quoted. That means that what gets passed to bash goes through marcel parsing. To get higher degrees of compatibility with bash, I may need to resort to quoting, e.g. bash "...". Or perhaps allow that, but still support quote-less usage in simpler cases. Supporting more than the most basic bash commands has not been a high priority. My reasoning is that if you want to do more complex things in bash, then maybe just use bash. By the way, if you are in marcel, then this should work: bash cat "$(which marcel)". I guess rather than figuring out quoting strategies like this, it would be better to just quote the whole thing. |
I suppose that fixing the issue with quoting shouldn't be very hard and sure worth the effort. If I would need to switch to another shell to execute commands like it is specified by POSIX ... I can also directly run a Python module in IDLE instead of pretending to have a shell in a Terminal. There a Python modules out there targeting better interface to shell while working with shell commands. By the way:
does not work (my most basic text editor I am using for input of short texts) ... what allows the conclusion that marcel as it currently is, is not a shell with extended capabilities compared to dash like the bash shell is, but just a python toy to play around providing most basic shell operations you need to learn the syntax of in order to use them in first place. In other words ... I suggest that in first step you just pass all the marcel input interactively to bash keeping a bash session running and mirror its output. This way you are sure you have all the shell features a shell user expects from a shell. In the second step you need to find a way to distinguish user input targeted towards the standard shell from user input targeting the extended capabilities of marcel in order to provide the extensions and to support additional features keeping the bash session up to date with the user input targeted at the extensions marcel comes with. Don't take this above too serious ... I am probably not yet deep enough into the marcel shell to see what it is really good for. Is learning to cope with one more special shell language of the marcel shell worth the effort? I don't know for sure. At the current stage I am somehow not ready to learn one more syntax to obey to and to remember how it differs from the already known one switching between the two depending on what I want to achieve. |
And yes ... right quotation is a pain while using a shell ... to know when and what needs to be escaped too. I am somehow not ready to adjust myself to the needs of the machine ... I want the machine to adjust to my needs ... (this is what oOo is about https://github.com/oOosys/oOo ) |
Are you aware if IPython?
IPython keeps the history of the sesions, so the commands used in a previous session can be reused in the current one and the basic shell commands don't even need the |
Another approach similar to marcel shell is https://github.com/zqqqqz2000/shshsh . Isn't it? |
You've raised a few issues:
|
OK ... I see now that the focus and requirements of oOo differ from the core idea behind marcel shell to an extent where it makes maybe sense to drop the idea of adapting the shell to the needs of oOo. How would oOo approach the task you have provided the code for? The core idea behind In other words, in an oOo system you will have a huge amount of applications (with multiple different names for the same one), but with a shell capable of picking out the best fit to your description passed on the input line. And if there isn't one yet ... you program it and name in a way which makes it very probably that you get it with autocomplete on describing the task on the command line. Does it generally make sense to you? Would such shell make sense? You wouldn't need to learn any new language and obey to its rules or remember names of executable files. You don't need to remember where to put braces or commas and where not ... With a precise description of the task to perform you would get the right executable. If the directory name was the result of a previous command you would then run after the previous command "put last output to 'directory'" before running the executable establishing this way a pipe-chain if necessary. Having a shell capable of spitting out the right executable from description of the task ... taking it as command and making any chains possible ... A part of that concept is already implemented in the marcel shell - maybe JSON would be a better way as pickling Python objects because programming language independent? OK ... for YOUR needs marcel shell is the perfect tool ... you were already using Python, so why not using it as reference for passing data structures ... but ... what if you want use the output as input for another not Python based application or a script in another programming language? In other words ... I am ready to accept closing this issue ... being now aware that marcel shell is not designed to be a shell-replacement. It is a shell mechanisms based Python REPL useful in the by you provided context, but not as a general purpose system shell, right? |
Maybe it would be a good idea to make it clear in the description of this project that marcel shell is not designed to be a replacement for a shell, but a shell-like way of using a Python REPL capable to performing system tasks utilizing the concept of piping data between commands? |
This is not something that fits the way I work. I think that natural Other issues you raised:
Dumb example, but it shows that marcel can pass data to standard Linux It works the other way too. Here is a command using marcel and Linux
Marcel also supports other common interchange formats, including JSON
I'll close this issue once bash passes a quoted string instead of |
This is fixed. You can now run bash commands as before, by providing a set of strings and expressions. As oOosys noted, that is error-prone. To address these concerns, partially, you can now pass a string to the bash operator which gets passed through as is. This should improve the bash escape, but I have no doubt that further improvements can be made. I'll let improvements be driven by usage and bug reports. |
Hmmm ... why is it a problem to pass shell commands to bash executing
bash -c "any command, also multi-line"
and to mirror bash output to the Terminal ??? General flaw in the approach of parsing the input line ?The text was updated successfully, but these errors were encountered: