News for hackers. Stuff that matters.
Re:Renaming files with mv without typing the name two times by bb88 on Tuesday April 14, 2020 @03:26AM (#22863495)

    $ mv --help
    Usage: file [OPTION...] [FILE...]
    Determine type of FILEs.
So mv --help now returns the help for the `file` command. You're right, that's not worth warning people at all.

God help any user that's on a shared system whose sysadmin thinks this is a good idea putting in the default /etc/profile.

To be fair, I don't feel like I'm being pedantic. I'm anti-footgun.

Re:Renaming files with mv without typing the name two times by titzer on Tuesday April 14, 2020 @03:51AM (#22863610)
> sysadmin thinks this is a good idea putting in the default /etc/profile

Well that, I agree, would be dumb.

Re:Renaming files with mv without typing the name two times by kilpikaarna on Tuesday April 14, 2020 @11:54PM (#22874339)
You could just filter out anything that begins with a dash and pass it to mv. It seems like mv always interprets that as an option anyway, even if you have a file named --help or whatever.

I like this kind of thing! Minimal code but very elegant from a UX perspective. The oh but you could just mv foo-{bar,baz}.txt crowd is completely missing the point.

Re:Renaming files with mv without typing the name two times by kelnos on Thursday April 16, 2020 @06:14AM (#22887872)
> The oh but you could just mv foo-{bar,baz}.txt crowd is completely missing the point.

I disagree. I think a better way to think about things is, "can I accomplish my goal most of the time using the standard tools without writing something custom?" I'll be the first to admit that there are a ton of things in the shell and in coreutils that I don't know about. I bet I've written several scripts over the years with custom functionality that could be replaced with standard tools I didn't know about. That's the thing that I want to avoid.

Re:Renaming files with mv without typing the name two times by bb88 on Wednesday April 15, 2020 @03:37AM (#22875457)
I love bash. I love unix/linux. I love that bash gives you that kind of power. I love the fact that he figured out a nifty way of doing this.

But please please please please with all the love of America, baseball, and apple pie, don't change the default behavior of basic unix commands.

Otherwise you force people into writing nonsense like this:

MV=/usr/bin/mv

${MV} ${FILE1} ${FILE2}