Skip to content

touch doesn't handle glob properly #13623

Closed
@NotTheDr01ds

Description

Describe the bug

The signature for touch says that it takes:

...rest: <one_of(glob, path)> The file(s) to create.

However, attempting to use a glob does not appear to work

How to reproduce

touch foo bar baz; sleep 30sec; touch *; ls
╭───┬──────┬──────┬──────┬────────────────╮
│ # │ name │ type │ size │    modified    │
├───┼──────┼──────┼──────┼────────────────┤
│ 0*    │ file │  0 B │ now            │
│ 1 │ bar  │ file │  0 B30 seconds ago │
│ 2 │ baz  │ file │  0 B30 seconds ago │
│ 3 │ foo  │ file │  0 B30 seconds ago │
╰───┴──────┴──────┴──────┴────────────────╯

Expected behavior

Perhaps I'm stuck in a Bashim here, but I don't think so. I'm expecting ls * to be interpreted as:

Update the modified time on every file in the current directory

Changing the second touch to use the external:

> touch foo bar baz; sleep 30sec; ^touch *; ls
╭───┬──────┬──────┬──────┬──────────╮
│ # │ name │ type │ size │ modified │
├───┼──────┼──────┼──────┼──────────┤
│ 0 │ bar  │ file │  0 B │ now      │
│ 1 │ baz  │ file │  0 B │ now      │
│ 2 │ foo  │ file │  0 B │ now      │
╰───┴──────┴──────┴──────┴──────────╯

Additional info

Note: Even forcing * into a variable typed as a glob doesn't work.

Screenshots

No response

Configuration

key value
version 0.96.1
major 0
minor 96
patch 1
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.78.0 (9b00956e5 2024-04-29)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.78.0 (54d8815d0 2024-03-26)
build_time 2024-07-31 16:40:52 -04:00
build_rust_channel release
allocator mimalloc
features default, sqlite, system-clipboard, trash
installed_plugins

Additional context

No response

Metadata

Assignees

Labels

🐛 bugSomething isn't workingfile-systemRelated to commands and core nushell behavior around the file systemglob-expansionSpecific behavior around file-system globbing with regular commands or `glob`inconsistent-behaviorBehavior between different commands or types inconsistent/unexpected

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions