-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Allow joining and splitting on null bytes when calling system shell commands #9336
Comments
The attributes on an SList are for rejoining it with different separators, rather than for splitting it. I don't think splitting on a null byte is common enough to build in, but it should be a one-liner where you want it: files.n.split('\x00') |
Yes, and
I'm a little surprised to hear this. Imho it is very common to do this. Many unix utilities, like find ( When IPython is used as a shell script replacing bash, utilities like this have to be as easy and convenient as possible. As a side note, is it possible to obtain the output of a |
(I take it you meant null bytes instead of newlines) I understand the argument that this is the right thing to do, but I don't think I've ever seen someone actually doing it, or a shell script written like that.
I don't know of any built in way to do that. But you can easily convert it: |
Okay, I see it all the time. As soon as filenames contain whitespace you need something like this. An alternative way to do it is by explicitly telling |
This has been marked as no-action and had no comment in about a year. I'm going to close to try to keep the number of active issue reasonable. Feel free to reopen if needed. |
IPython has this very pretty way of calling shell commands:
This is automatically split on newlines, such that
files
is of typeSList
. But if we change the above call towhich is actually more common, we end up with an
SList
with one string containing a lot of null bytes. I believe there is currently no way to have the output of the find command split on null bytes before it is stored infiles
. It would greatly improve the usability of IPython as shell script to have this as a feature IMHO, so there's my feature request. :)It would be easy to add a
.z
attribute toSList
etc, but I'm not sure about the combination with the!
syntax. Any thoughts?Since there is no way to split on spaces using the
!
syntax either, maybe it's just okay to settle for the.z
properties. Would a PR implementing this be good for merge?The text was updated successfully, but these errors were encountered: