home | list info | list archive | date index | thread index

Re: Directory starting with ''$'\n''

On Sat, 29 Nov 2025 02:18:59 -0800
Ron via linux <linux [ at ] linux-ottawa [ dot ] org> wrote:

> $ touch $'\nbad_file'
> $ rm bad_file	## tab completion supplied the file name
> rm: cannot remove 'bad_file': No such file or directory

When I try it, tab completion (I use bash) works for me:

$ touch $'\nbad_file'
$ ls 
''$'\n''bad_file'
$ rm '
bad_file' 
$ ls

I typed rm <TAB> and it completed correctly.

> And, wildcards fail too, in some cases:

A wildcard inside single quotes is not expanded; that's expected.
rm *bad* should work:

$ touch $'\nbad_file'
$ rm -v *bad*
removed ''$'\n''bad_file'

> One part I won't retract is my contention that support for line feeds
> in file names is a bad idea.

Well, maybe, but that's certainly not going to change at the kernel
level at this point.  It would be considered a change that breaks
user-space.  And if the kernel supports it, user-space tools are
obliged to as well... otherwise, someone could create a file that
really *can't* be renamed or deleted with standard tools.

Regards,

Dianne.

To unsubscribe send a blank message to linux+unsubscribe [ at ] linux-ottawa [ dot ] org
To get help send a blank message to linux+help [ at ] linux-ottawa [ dot ] org
To visit the archives: https://lists.linux-ottawa.org

message navigation