On Fri, Jul 18, 2014 at 3:38 PM, Robert Moonen <[email protected]> wrote:
> On 17/07/14 21:51, Brett Pemberton wrote:
>> On Thu, Jul 17, 2014 at 9:35 PM, Daniel Jitnah
>> <[email protected]> wrote:
>>>> I'd have the same response to someone using _ instead of a space.
>>>> Why bother?
>>> May be because:
>>>
>>> danyj@git-deb7-64:~/test$ touch windows
>>> danyj@git-deb7-64:~/test$ touch 7
>>> danyj@git-deb7-64:~/test$ touch windows\ 7
>>> danyj@git-deb7-64:~/test$ ls -l
>>> total 0
>>> -rw-r--r-- 1 danyj danyj 0 Jul 17 21:23 7
>>> -rw-r--r-- 1 danyj danyj 0 Jul 17 21:23 windows
>>> -rw-r--r-- 1 danyj danyj 0 Jul 17 21:23 windows 7
>>> danyj@git-deb7-64:~/test$ rm -rf windows 7
>>> danyj@git-deb7-64:~/test$ ls -l
>>> total 0
>>> -rw-r--r-- 1 danyj danyj 0 Jul 17 21:23 windows 7
>>> danyj@git-deb7-64:~/test$
>>>
>> Sorry, I'm honestly at a loss as to what you were demonstrating there.
>
> Ehm, he is demonstrating that bash command line utilities become easily
> confused then using files with spaces in their names.

Err, no, they don't.

>
> What was asked? 1.) to delete the file windows 7

Not even close

> What happened? 1.) the files windows and 7 were deleted

As it was asked to do.

What this shows is that if you don't use interactive mode on your rm
commands, and don't sanity check that you're asking to remove the
correct file, you may accidentally remove the wrong file. That's true
whether there are spaces in your filenames or not.

The command in question wasn't confused at all. The user was.
As I said in a private response, the issue here is a user giving the
wrong input to rm, we can all agree on that, right?

Some people's reaction to this hypothetical problem is "Don't use
spaces in filenames, then you won't accidentally remove the wrong
files when you tell rm to rm the wrong files"
My reaction is "Don't tell rm to remove the wrong files".

Use rm -i
Do: ls "this is the file I want to remove" first, and then after
confirming that it's correct, up arrow, home, repace ls with rm
Use tab completion to assist in hitting the right file
etc etc.

However treating this hypothetical by arbitrarily choosing a subset of
POSIX-OK characters in filenames is a silly response, in my opinion.
Yours may vary, and that's fine.

     / Brett
_______________________________________________
luv-main mailing list
[email protected]
http://lists.luv.asn.au/listinfo/luv-main

Reply via email to