rmyorston / busybox-w32

WIN32 native port of BusyBox.
https://frippery.org/busybox
Other
693 stars 126 forks source link

`ash` - hidden system files and globbing #367

Closed naksyl closed 10 months ago

naksyl commented 1 year ago

Recent release add support for hiding files with system attribute (ls -AA). This reminds me that globbing show files with hidden attribute wich I belive shoud be treated as Unix dotfiles (ls does not show them)

~ $ ls | grep -i ^nt

~ $ printf "%s\n" * | grep -i ^nt
NTUSER.DAT
NTUSER.DAT{a2332f18-cdbf-11ec-8680-002248483d79}.TM.blf
NTUSER.DAT{a2332f18-cdbf-11ec-8680-002248483d79}.TMContainer00000000000000000001.regtrans-ms
NTUSER.DAT{a2332f18-cdbf-11ec-8680-002248483d79}.TMContainer00000000000000000002.regtrans-ms
ntuser.dat.LOG1
ntuser.dat.LOG2
ntuser.ini

~ $ lsattr nt* NT*
------hsa-- ntuser.dat.LOG1
------hsa-- ntuser.dat.LOG2
------hs--- ntuser.ini
------h-a-n NTUSER.DAT
------hsa-- NTUSER.DAT{a2332f18-cdbf-11ec-8680-002248483d79}.TM.blf
------hsa-- NTUSER.DAT{a2332f18-cdbf-11ec-8680-002248483d79}.TMContainer00000000000000000001.regtrans-ms
------hsa-- NTUSER.DAT{a2332f18-cdbf-11ec-8680-002248483d79}.TMContainer00000000000000000002.regtrans-ms
rmyorston commented 1 year ago

The shell now has (non-standard) options to control how the hidden and system attributes affect globbing:

Note:

An example of the use of the new options (plus the existing nocaseglob):

~ $ set -o nocaseglob
~ $ lsattr nt*
------h-a-n NTUSER.DAT
------hsa-- NTUSER.DAT{53b39e88-18c4-11ea-a811-000d3aa4692b}.TM.blf
------hsa-- NTUSER.DAT{53b39e88-18c4-11ea-a811-000d3aa4692b}.TMContainer00000000000000000001.regtrans-ms
------hsa-- NTUSER.DAT{53b39e88-18c4-11ea-a811-000d3aa4692b}.TMContainer00000000000000000002.regtrans-ms
------hsa-- ntuser.dat.LOG1
------hsa-- ntuser.dat.LOG2
------hs--- ntuser.ini
~ $ set -o nohidsysglob
~ $ lsattr nt*
------h-a-n NTUSER.DAT
~ $ set -o nohiddenglob
~ $ lsattr nt*
lsattr: can't stat 'nt*': No such file or directory
~ $
naksyl commented 1 year ago

The options also affect tab completion.

Nice surprise.