Skip to content

'mv *' moves dotfiles too #14858

Open
Open
@GasparVardanyan

Description

~/a> touch .a .b .c d e f
~/a> ls *   # * matches everything but dotfiles as expected
╭───┬──────┬──────┬──────┬──────────╮
│ # │ name │ type │ size │ modified │
├───┼──────┼──────┼──────┼──────────┤
│ 0 │ d    │ file │  0 B │ now      │
│ 1 │ e    │ file │  0 B │ now      │
│ 2 │ f    │ file │  0 B │ now      │
╰───┴──────┴──────┴──────┴──────────╯
~/a> ls -a 
╭───┬──────┬──────┬──────┬──────────╮
│ # │ name │ type │ size │ modified │
├───┼──────┼──────┼──────┼──────────┤
│ 0 │ .a   │ file │  0 B │ now      │
│ 1 │ .b   │ file │  0 B │ now      │
│ 2 │ .c   │ file │  0 B │ now      │
│ 3 │ d    │ file │  0 B │ now      │
│ 4 │ e    │ file │  0 B │ now      │
│ 5 │ f    │ file │  0 B │ now      │
╰───┴──────┴──────┴──────┴──────────╯
~/a> mkdir ../g
~/a> mv * ../g  # but now it matches dotfiles too
~/a> ls -a
╭────────────╮
│ empty list │
╰────────────╯
~/a> # the expected behaviour was to see dotfiles untouched
~/a> cd ../g
~/g> ls -a
╭───┬──────┬──────┬──────┬──────────────╮
│ # │ name │ type │ size │   modified   │
├───┼──────┼──────┼──────┼──────────────┤
│ 0 │ .a   │ file │  0 B │ a minute ago │
│ 1 │ .b   │ file │  0 B │ a minute ago │
│ 2 │ .c   │ file │  0 B │ a minute ago │
│ 3 │ d    │ file │  0 B │ a minute ago │
│ 4 │ e    │ file │  0 B │ a minute ago │
│ 5 │ f    │ file │  0 B │ a minute ago │
╰───┴──────┴──────┴──────┴──────────────╯
~/g> rm *
~/g> ls -a
╭───┬──────┬──────┬──────┬──────────────╮
│ # │ name │ type │ size │   modified   │
├───┼──────┼──────┼──────┼──────────────┤
│ 0 │ .a   │ file │  0 B │ a minute ago │
│ 1 │ .b   │ file │  0 B │ a minute ago │
│ 2 │ .c   │ file │  0 B │ a minute ago │
╰───┴──────┴──────┴──────┴──────────────╯
~/g> # now * matches everything but dotfiles
~/g>  

And I accidientially maked my home folder mess because of this weirdo mv behaviour...

Metadata

Assignees

No one assigned

    Labels

    file-systemRelated to commands and core nushell behavior around the file systemglob-expansionSpecific behavior around file-system globbing with regular commands or `glob`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions