|
|
|
|
|
by joosters
3709 days ago
|
|
You miss my point. Of course, for every example I give, it's possible to build a workaround to handle the spaces. My point is, it's the very fact that you need a workaround that makes it so irritating. 'command1 | command2' just works in most circumstances, so it's frustrating that it falls apart when a filename with a space appears. And it technically is a shell issue, insomuch as the shell is dividing up the ARGV for each program. The shell is perhaps not to blame, because it can't tell the difference between a filename that has a space in it, and ordinary output that just so happens to correspond with a filename. In other words, it's hard to see what a shell could do to make things better. But the problem still exists. |
|
In that example we're not in front of a bash word splitting issue.
I agree with you that shell scripting has caveats one need to learn. As does Perl, C, PHP, Ruby, Node, Go, Java and what not.
I don't feel a big change is needed to handle spaces in shell scripts, my scripts handle them and I enjoy writing them. Maybe you know of minor tweaks for bash,zsh or any common shell which could be useful in general purpose of files with spaces in the name? don't hesitate to open them a bug, maybe we even get a fix.
But don't send them this example, and insist on it, because the conversation is over:
Equivalent input, with/without spaces and expected output.The 2 is a word count, and we did pass two words, I don't expect a 1 there, _that_ could be a bug.