Earlier quoted context omitted.
I think the parent was referring to using awk/sed to do the equivalent of: find ... | tr '\n' '\0' | xargs -0 ... I.e., a blind replacement without the tool having any particular semantic understanding of what it's translating. That still requires your xargs to have -0 support, though, and I'd be surprised to have that without the corresponding option on find. But I've done this before when feeding xargs from somethi…
It is also built on the assumption that filenames never contain newlines, which is wrong in general. It's baffling to me that POSIX allows non-printable characters in file names, but here we are. Surely they had a reason for this decision.
I wrote an bash enumerator because I was sick of xargs
191–200 of 202 posts
Re: I wrote an bash enumerator because I was sick of xargs
#192In this thread: bash experts with arcane knowledge, unintentionally demonstrating how awful bash is. The obvious solution would be to use something more sane, like PowerShell or nushell, but instead old experts will always defend the skills they have honed for years, while criticizing anything that's different.
As others have pointed out throughout the thread, the reason we defend the skills is that there’s a high likelihood that these tools will always be available on any machine; PowerShell and nushell, not so much.
Re: I wrote an bash enumerator because I was sick of xargs
#193> Or maybe you pipe into xargs and pray your filenames don’t have spaces So they wrote a new tool and posted it on HN before checking the manual about null character termination... Not trustable at all, what a waste of time!
Same thought I had, and that is where I stopped reading. All of these looping/enumerating techniques, including the weirdness with null-terminating strings to get around the shell's inherent treatment of spacing, are muscle memory for anyone that has spent more than 27 minutes in the shell at any point in the last 30 years. Yes it's weird because it's old. Deal with it. Why make yet another tool with yet another set…
Obviously because not all sets are equal?
Re: I wrote an bash enumerator because I was sick of xargs
#194Earlier quoted context omitted.
Shells imo are legacy on legacy, I like bash and zsh, they’re nonsensical but they work. Powershell is undoubtedly saner, but I hate it. I think the whole concept could be rewritten from the ground up to be modern, but reaching critical mass and mvp is too damn difficult, and the majority of mac/Linux users probably don’t want it.
If you build it and it's better, they will come. None of us here are building it.
Re: I wrote an bash enumerator because I was sick of xargs
#195Earlier quoted context omitted.
If you build it and it's better, they will come. None of us here are building it.
There are already alternative shells. I think there’s some stuff fairly deeply rooted into gnu that’s an ‘issue’ for rebuilding and turns an effort into a complete redesign, making the whole thing hard to achieve.
Re: I wrote an bash enumerator because I was sick of xargs
#196Re: I wrote an bash enumerator because I was sick of xargs
#197On the topic of xargs replacements, I love gnu parallel. The --dry-run flag of parallel made me confident to do more batch processing than I ever did with xargs. Parallel has an option for almost everything, it's almost too much. But I have shopped around for alternatives. The creator Ole Tange maintains a painstakingly long article of the alternatives and their differences. [0] The gnu parallel book and reading mate…
Oh man, parallel is awful. I have to rant about this because I literally tried it again today morning. Every single damn time I try parallel and decide to give it another chance, something ends up not working or causing a problem. I can never get it to just do what I want and get out of the way. Today I foolishly thought maybe I was the one who was holding it wrong every single time in the past, so I copy pasted anot…
Re: I wrote an bash enumerator because I was sick of xargs
#198On the topic of xargs replacements, I love gnu parallel. The --dry-run flag of parallel made me confident to do more batch processing than I ever did with xargs. Parallel has an option for almost everything, it's almost too much. But I have shopped around for alternatives. The creator Ole Tange maintains a painstakingly long article of the alternatives and their differences. [0] The gnu parallel book and reading mate…
isn't parallel that tool that dumps some kind of begging message into your output each time you invoke it?
Re: I wrote an bash enumerator because I was sick of xargs
#199Earlier quoted context omitted.
3 reasons against that: * in a lot of cases the performance just doesn't matter * xargs gets you the spaces in filenames landmine * some commands don't even support multiple target filename arguments For scripts in long term use, yeah, sure, figure out xargs maybe. Any other situation with a "| while read" solution, especially on an interactive session, is an oddball and simplicity wins.
xargs supports null termination. While it's true not every command supports multiple targets, presumably you know if you're using one of those commands.
Does whatever I'm piping into it though? It's "find" in maybe 30% of cases for me, no more, and null termination is not exactly common in other tools.
Re: I wrote an bash enumerator because I was sick of xargs
#200Earlier quoted context omitted.
3 reasons against that: * in a lot of cases the performance just doesn't matter * xargs gets you the spaces in filenames landmine * some commands don't even support multiple target filename arguments For scripts in long term use, yeah, sure, figure out xargs maybe. Any other situation with a "| while read" solution, especially on an interactive session, is an oddball and simplicity wins.
>* xargs gets you the spaces in filenames landmine Ignorance of xargs gets you the landmine. Understanding of xargs, helps you complete the mission without blowing off limbs. $ find . -name "Some Files With Spaces*.txt" -print0 | xargs -0 -I {} echo "Processing: {}" # landmine avoided