Skip to main content
26 events
when toggle format what by license comment
Nov 24, 2018 at 21:40 vote accept Tim
Nov 23, 2018 at 17:39 answer added Stéphane Chazelas timeline score: 3
Nov 23, 2018 at 17:11 comment added Stéphane Chazelas execve() takes a list of pointers to NUL-delimited string, so there can't be any NUL in those strings.
Nov 23, 2018 at 17:09 comment added Tim @StéphaneChazelas Do you mean when xargs calls execve(), excve() will strip them, by "xargs will either strip them or complain about them"? I don't want to use xargs -0 on a NUL-delimited output.
Nov 23, 2018 at 17:06 comment added Stéphane Chazelas You can't pass NUL characters as argument to a command anyway. xargs will either strip them or complain about them as well. Or do mean you want to use xargs -0 on a NUL-delimited output?
Nov 23, 2018 at 15:42 answer added user313992 timeline score: 3
Nov 23, 2018 at 14:40 comment added Tim either enter manually or from stdout of a previous command. @ilkkachu
Nov 23, 2018 at 14:39 comment added ilkkachu "I don't want to use command substitution, because it removes NUL and trailing newlines" , and "xargs will ask for input from stdin, and that is what I want.". -- Err, I'm not sure what the actual use case is here. Are you entering NUL bytes from the terminal manually, or... what?
Nov 23, 2018 at 14:35 comment added Tim Trying to find a nicer "command substitution", without removing anything or as few as possible. It doesn't matter that the system call execve() will remove NUL. I just want to pass all the content without change. @StephenKitt
Nov 23, 2018 at 14:34 history edited Tim CC BY-SA 4.0
added 9 characters in body
Nov 23, 2018 at 14:34 comment added Stephen Kitt See Kusalananda’s first comment. The whole point of xargs is to not do what you’re trying to do. I can’t suggest an alternative without knowing the specifics of what you’re trying to do.
Nov 23, 2018 at 14:34 history edited Tim CC BY-SA 4.0
added 17 characters in body
Nov 23, 2018 at 14:31 answer added JigglyNaga timeline score: 2
Nov 23, 2018 at 14:30 comment added Tim @StephenKitt Is your answer to my post that xargs can't always run all arguments at once? What is some alternative to xargs for my distracting questions.
Nov 23, 2018 at 14:28 comment added Stephen Kitt And it’s apparent that xargs doesn’t meet all your requirements. If you explain what you’re actually trying to do (and not how you’re trying to use xargs to go about it), we might be able to suggest an alternative which doesn’t involve xargs.
Nov 23, 2018 at 14:25 comment added Tim @StephenKitt xargs ls will ask for input from stdin instead of command line arg, and that is what I want. A command run by xargs might not give the same result before and after xargs groups the arguments, and that is what I want to avoid. These are questions but not really the question asked in my post.
Nov 23, 2018 at 14:09 comment added Stephen Kitt Could you explain what you’re trying to do in a bit more detail? I imagine you’ve got either a file, or a command outputting some data, which you want to use as arguments for another command, but only run the latter command if you can do so with all the data as arguments — is that correct? Can the second command take its input from its standard input instead?
Nov 23, 2018 at 13:54 comment added Stephen Kitt Because NUL terminates individual arguments in argv.
Nov 23, 2018 at 13:53 comment added Tim Why is it not possible If you want to pass chunks of data containing NULs via the command line (via the arguments to execve(2))?@mosvy
Nov 23, 2018 at 13:49 history edited Tim CC BY-SA 4.0
added 61 characters in body
Nov 23, 2018 at 13:40 comment added user313992 If you want to pass chunks of data containing NULs via the command line (via the arguments to execve(2)), forget about it. This is not possible, in any language. If you want to bypass the length limit imposed by the OS on the args + env and run a prog with a huge nr of args, there may be hacky ways of doing it, but not with the standard tools.
Nov 23, 2018 at 13:30 history edited Tim CC BY-SA 4.0
added 21 characters in body
Nov 23, 2018 at 13:20 history edited Tim CC BY-SA 4.0
added 21 characters in body
Nov 23, 2018 at 13:11 history edited Tim CC BY-SA 4.0
added 344 characters in body
Nov 23, 2018 at 13:07 comment added Kusalananda One of tho reasons for using xargs is that very long lists of arguments simply can't be given to a utility in one go as the argument list has an upper length limit. xargs will by default give as many arguments as possible to the utility. An example of your issue would be good to see (please edit your question).
Nov 23, 2018 at 12:59 history asked Tim CC BY-SA 4.0